Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
aoriju
Posting Yak Master
156 Posts |
Posted - 2012-10-04 : 09:12:17
|
Hi all,How to insert a sp_executesql statementExample: insert into [dbo].[tbl_ETS_DataHolder]exec sp_executesql @strSql WITH RECOMPILE; |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-10-04 : 09:23:31
|
Did you try what you have posted?Is the result not what you need?Are there any error messages? Too old to Rock'n'Roll too young to die. |
|
|
aoriju
Posting Yak Master
156 Posts |
Posted - 2012-10-04 : 09:27:33
|
not getting any error...but data not inserted |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-10-04 : 09:36:15
|
is there any output if you run that exec... without insert? Too old to Rock'n'Roll too young to die. |
|
|
aoriju
Posting Yak Master
156 Posts |
Posted - 2012-10-04 : 09:38:30
|
yes output is there..do we need any out parameter or ?..then pls provide the syntax |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-10-04 : 09:47:47
|
On the given information I can say: it should work.But I can't see what you are really doing.Is this little test working for you?declare @sql nvarchar(max)set @sql = 'select ''Test'''create table #sample (testcol varchar(255))insert #sampleexec sp_executesql @sql with recompileselect * from #sampledrop table #sample Too old to Rock'n'Roll too young to die. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
|
|
|