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 comments
file management
Dan 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?

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • NewsVine
  • Reddit
  • StumbleUpon
  • YahooMyWeb
  • Google
  • Yahoo! Buzz
  • TwitThis
  • Live
  • LinkedIn
  • Pownce
  • MySpace
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?”
  1. Joey M Says:

    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.

  2. Bryan S Says:

    The real way would be to get the acccess you need and create a stored procedure.

  3. dhvrm Says:

    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}

Leave a Reply

Hamiilton Ontario Real Estate Agent | Cincinnati Bankruptcy Attorney | Qatar Travel | Fat Loss | Entries RSS Comments RSS Log in