sql server - Merge Into with no rows -


is there way use instruction:

merge myschema.mytable target using (values ........ ) 

with nothing instead of dots? have there list of (firstvalue, secondvalue,...,lastvalue), 1 each row want merge i'd able write instruction no rows delete part of merge deletes rows.

this because using stored procedure creates merge instruction automatically table starting empty.

of course tried with:

merge myschema.mytable target using (values)  

but not accepted.

thank you.

if you're generating inside query, , outside query matching on predefined id field, following work:

merge tester target using (  select null test1 --generate select null, alias id field ) source on target.test1 = source.test1 when not matched source      delete; 

for particluar case:

merge table1 target using (  values(null) ) source(id) on target.id = source.id when not matched source      delete; 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -