Click here to Skip to main content
15,920,031 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
declare @in int

Declare @t1 varchar(300)

set @t1 = 'Tbl_401_Employee_Creation'

set @in ='(''Select count(emp_id) from' + @t1+ ')'

select @in as twist



I have to send the values to master and child tables at a time . here primary key in master table is identity.when i write code to get that primary it shows error that is is not getting value instead it remains as query.
Posted
Updated 26-Mar-14 20:39pm
v2

1 solution

Go through sp_executesql[^] to execute dynamic queries.
 
Share this answer
 
Comments
ravikiran geddam 27-Mar-14 8:09am    
Could you Please tell me clearly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900