|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 6:56 AM
Points: 679,
Visits: 953
|
|
Hi,
I have this stored procedure:
create proc ExecuteScripts (@SQLstat varchar(max)) as begin exec SQLstat end
When i try to create this procedure i receive the following warning from SQL Server:
Cannot add rows to sys.sql_dependencies for the stored procedure because it depends on the missing table 'SQLstat'. The stored procedure will still be created; however, it cannot be successfully executed until the table exists.
But SQLstat is a variable that i want to pass, not a table...
Can someone explain?
Thank you
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 9:22 AM
Points: 36,
Visits: 207
|
|
Assuming that you are passing the script to be executed in @SQLStat parameter, your procedure should be:
create proc ExecuteScripts (@SQLstat varchar(max)) as begin exec ( @SQLstat ) end
Also check sp_executesql if you need to use dynamic sql.
Neepa
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 6:56 AM
Points: 679,
Visits: 953
|
|
|
|
|