October 11, 2013 at 11:21 am
I have used the filetable to store the tsql scripts. what can be the best way to run them against the server. the only road block i have using the exec(@sql) or execute_sql (@command) is the 'GO' statement in the filetable script.
Any help will be appriciated. Thanks
October 11, 2013 at 3:22 pm
AK1516 (10/11/2013)
I have used the filetable to store the tsql scripts. what can be the best way to run them against the server. the only road block i have using the exec(@sql) or execute_sql (@command) is the 'GO' statement in the filetable script.Any help will be appriciated. Thanks
Take the GO out. It won't work with EXEC or EXECUTE_SQL. If the GO is important to the success of the script, then you will need to split the script at the GO and execute each section separately.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 11, 2013 at 3:43 pm
I have used the filetable to store the tsql scripts. what can be the best way to run them against the server. the only road block i have using the exec(@sql) or execute_sql (@command) is the 'GO' statement in the filetable script.
Any help will be appriciated. Thanks
There are different methods for querying the contents of a document stored in a filetable. I haven't done it personally but have seen Sam Nasr do it (SQL Saturday Detroit :w00t:). Sam Nasr has some articles out there about this.
That said, what you are doing sounds like a bad idea to me. Filetables are not intended to for storing documents that contain scripts (SQL or other) that are executed directly from the filetable. The idea of a file on a file share (secured or otherwise) with scripts that can be executed from inside SQL Server. That sounds scary for too many reasons to detail in one post.
-- Itzik Ben-Gan 2001
October 12, 2013 at 9:10 am
And with that and the fact that I've seen many people try to do the same thing, I guess now would be a great time to ask...
... what's wrong with using stored procedures, etc, instead of all this saving of scripts either in a file or in a table? It just doesn't make sense to me to do such a thing.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply