sql server - dml query within WITH sql -


i supposing put set query within with statement in sql server 2008.

so wrote few lines of code:

with temp    (     select row_number() on (order [shareitems].itemid) row, itemid [shareitems] ) set @row = itemid //<---error 

but getting error above, in case of select statement using with keyword, there no error???

with temp    (     select          row_number() on (order [shareitems].itemid) row, itemid      [shareitems] ) select itemid  temp //<--- ok (no error) 

any suggestion ?

try way:

with temp    (   select row_number() on (order [shareitems].itemid) row, itemid    [shareitems] )  select  @row = itemid temp  

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -