error:
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
第一種種解決方式:
;with XMLNAMESPACES('http://schemas.myself.com/SomeSchema' as ns)
, t as
第二種種解決方式:
; with t (staffid, sheetno)
as
(select distinct staffid
, (case @tform WHEN 'B' THEN sheetno else (ROW_NUMBER() OVER (order by staffid asc)) end
) as sheetno
from tableXXX )
貌似錯誤只出現在存儲過程中,汗,搞不清