Use Select To Generate Any Insert/Delete/Update Statement

If you don't have the permission to generate script according to an existing db, but you have the read permission for that db, if so you can use select to generate the expceted insert/delete/update statements, furtherly, you can also do complicated condition jugement when generate the string.

Below is just persudo code:

select 'insert into tabe1 (file1,fiel2) values (''' + userid +'''' + ',' case userid when null
begin
'Null'
end
else
begin
userid
end
end case
from SurfacedCosmosdata

posted @ 2016-12-01 16:02  Researcher  阅读(106)  评论(0编辑  收藏  举报