Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Merge statement
--Title of this code --Batches are separated by 'go' select * from planes merge planes as target_planes --target table, could be common table expression using (select * from planes) as source_planes --source table, here the same as target on target_planes.Model = source_planes.Model when not matched then insert(Model, Built_date, Number_of_seats) --insert into target values(source_planes.Model, source_planes.Built_date, source_planes.Number_of_seats) when matched then /*delete*/ update set target_planes.Number_of_seats = 2*target_planes.Number_of_seats; select * from planes
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Comercio
Demo
Basic Template
forming date as nvarchar
Creation tables
h
sc
SQL Directives Order of Execution
QLCB_BTVN_TUAN 8
Cross Apply vs Inner Join
Please log in to post a comment.