how to give input dynamically to a insert statement in
sqlserver

Answer Posted / senthil kumar.m

Declare @sql_tmp varchar(100)

set @sql_tmp="insert into table1(col1,col2..)
select 'val1','val2','') "

sp_executesql @sql_tmp

Is This Answer Correct ?    0 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which operator do you use to return all of the rows from one query except rows are returned in a second query?

759


What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?

2032


What are the restrictions while creating batches in sql server?

757


What is the user of Primary key?

737


Disadvantages of the indexes?

752






as a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this? : Sql server administration

726


What is statement level trigger?

749


What different steps will a sql server developer take to secure sql server?

720


Suppose you want to implement the many-to-many relationships while designing tables. How would you do it?

718


What is compression - row-level and page-level compression?

680


Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?

793


What happens when converting big values to integers?

727


Name and describe few console utilities for ssrs?

264


What is ssrs?

109


What is the importance of a recovery model?

768