Mar 31
in MS SQL Server Management Studio, I want to read part of my query from a file on my hard disk. How?
File Management Add commentsDan asked:
In C programming, for example, you can specify that a #include file contains part of your program, so the C language sees the #include directive and incorporates the content of the file into your program at compile time. I want to do this with MS SQL SMS. I have read-only access on the database, so I can’t store procedures, etc. But I want some kind of modularity so I don’t have to cut-and-paste duplicative code. How can I do this?
3 Responses to “in MS SQL Server Management Studio, I want to read part of my query from a file on my hard disk. How?”
Leave a Reply















April 3rd, 2008 at 8:44 am
There is no equivalent in SQL to the C/C++ language #include directive.
What SQL does have is stored procedures and user defined functions.
If you are stuck with read only access then cut and paste is your option.
April 5th, 2008 at 8:13 pm
The real way would be to get the acccess you need and create a stored procedure.
April 5th, 2008 at 10:05 pm
With read-only permission on the database, you’re stuck in your cut-and-paste hell.
However, you can save your SQL scripts(queries) using Management Studio, then open and execute them, using File –> Open –> File and File –> Save {queryname}