Hi, I want to create many files with SQL statements and then I want to write one SQL script file, which executes SQL statement in the other files. How can I do it?
Thanks, Radco
You could do it with Stored Procedures - create a bunch of them - then create one last one, which will execute the others.
If this doesn't do what you want - maybe you could explain your scenario in more detail
|||No it is not what I wanted. I can say to it, that I have a very long script which creates a database for testing, It has more than 2100 lines of SQL statements (mostly INSERT). It begins to be hardly manageable. So I want to split this one script into many files to simplify it. If I want to change something now I need to search 2100 lines of code. If I split it I will only change one smaller file.|||It is rather not possible to read SQL statement from file and run on SQL server using T-SQL, but you can create your files and next merge them together and run final one. or you can write simple VB application which will read your query and execute them on SQL server.
You can also try to use command line SQL tool osql to run your queries from inside dos batch file.
Thanks
No comments:
Post a Comment