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 |
landau66
Yak Posting Veteran
61 Posts |
Posted - 2014-02-11 : 10:16:59
|
Hello!I just wrote a stored procedure with dynamic SQL. It works! But I am not sure if it is safe or if it is prone to SQL-injection or other heinous attacks. alter proc sptest2 @tableIn sysnameasbegindeclare @table nvarchar(20)set @table = @tableInexec(N'select * from '+ @table)end Thank you very much and many greetingslandau |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-11 : 23:27:17
|
its prone to injection attack. You should use sp_executesql instead.See link Tan posted. It has pretty good explanation.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|