how to give input dynamically to a insert statement in
sqlserver

Answers were Sorted based on User's Feedback



how to give input dynamically to a insert statement in sqlserver..

Answer / ramadass

Write a store procedure for insert and pass the input value
as parameters to proc.

Is This Answer Correct ?    4 Yes 0 No

how to give input dynamically to a insert statement in sqlserver..

Answer / ashutosh rai

Declare @id int,@name varchar(100),@class varchar(100)
set @id=1
set @name='Ashutosh'
set @class='MCA'

insert into student_table(id,name,class)
values(@id,@name,@class)

Is This Answer Correct ?    3 Yes 2 No

how to give input dynamically to a insert statement in sqlserver..

Answer / 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

More SQL Server Interview Questions

what's the maximum size of a row? : Sql server database administration

0 Answers  


What are user-defined functions (udfs) in sql server?

0 Answers  


What is one of the first things you would do to increase performance of a query? For example, a boss tells you that ?a query that ran yesterday took 30 seconds, but today it takes 6 minutes?

2 Answers   Accenture, Merrill Lynch, Wipro,


What do you understand by mirroring and mention the advantages of the mirroring?

0 Answers  


What are explicit and implicit transactions?

4 Answers   BirlaSoft,






How to find Duplicate Records In table?

0 Answers   HCL,


Why union all is faster than union?

0 Answers  


Can we perform backup restore operation on tempdb? : sql server database administration

0 Answers  


Explain system views?

0 Answers  


What are sql servers used for?

0 Answers  


Does view occupy space?

0 Answers  


How can count the string ? for ex: If i have string like 'bhaskar' then i need like b:1 h:1 a:2 s:1 k:1 r:1 please give any idea on that

9 Answers   TCS,


Categories