Custom insert into statements creation using SQL Select Query

Some times we need to back up of insert statements, that time we can use below query.


select 'insert into EmpTable(id,name) values('''+CAST(Id AS varchar)+''''''+Name+''')' as query from empTable



Output:
insert into EmpTable(id,name) values('1''Ranga Rajesh')
insert into EmpTable(id,name) values('2''Kumar')
insert into EmpTable(id,name) values('3''Nambur')
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar