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 is statistics

1 Answers  


What is the difference between commit and rollback?

0 Answers  


Can I recover a damaged SQL Server 2008 database with the undamaged .mdb and .ldf files?

3 Answers   Apple,


What do you mean by cardinality?

0 Answers  


How to determine the service pack currently installed on SQL Server?

4 Answers   HCL,






ow to bring suspect mode datbase online from scratch

0 Answers  


An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest salaries(there are 4-5 people having the same salary which happens to be the highest).

9 Answers   ADP,


Can we execute a stored procedure inside a trigger?

6 Answers   BirlaSoft, CarrizalSoft Technologies, United Healthcare,


Do you know how to implement service broker?

0 Answers  


What are the advantages of using third-party tools?

0 Answers  


What is the joins and how many types of Joins in sql server a diffrentiate ever one give a suaitable query

2 Answers   Apollo,


What is a job?

3 Answers  


Categories