Showing posts with label parameter query. Show all posts
Showing posts with label parameter query. Show all posts

Sunday, January 14, 2018

How to create Insert or Update query from select statement

- Insert Query
SELECT 'INSERT INTO AspNetRoles VALUES ('''+CONVERT(NVARCHAR(50),Id)+''', '''+Name+''')' FROM AspNetRoles

- Update Query
SELECT 'UPDATE AspNetRoles SET Name = '+Name+' WHERE ID = '+Id+'' FROM AspNetRoles