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 the default Port No on which SQL Server listens?

0 Answers  


Is it possible to have more then one foreign key in a single table? if possible, is this the good way to design the table?

2 Answers  


my name is sejal I have cleared the sbi clerk exam. I am BCA graduate My favorite subject RDBMS Relational database management system. so please send me rRDBMS related interview questions

0 Answers  


How to check if a table is being used in sql server?

0 Answers  


If a stored procedure is taking a table data type, how it looks?

1 Answers  






can any body tell me how to know the password of current user in sql server

0 Answers   Crea, HCL,


What will be the maximum number of index per table?

0 Answers  


What is cursors? And what are the different types of cursor?

0 Answers  


What do you mean by tablesample?

0 Answers  


How to change the name of a database user?

0 Answers  


What do you mean by data integrity?

0 Answers  


Can a table have 2 foreign keys?

0 Answers  


Categories