When I run a T-SQL script in SQL Management Studio, is there a way to do something along the lines of a #include? I have a large list of GUIDs that I currently have to cut and paste into each .sql file, there has to be a better way!
Thanks
Stephen.
-
-
PerfectPhase wrote:When I run a T-SQL script in SQL Management Studio, is there a way to do something along the lines of a #include? I have a large list of GUIDs that I currently have to cut and paste into each .sql file, there has to be a better way!
Thanks
Stephen.
Create a UDF that returns your GUIDS as a table. -
These are mainly test scripts, so I would like to avoid adding anything extra to the database. I also would like to be able to share chunks of sql between scripts hence the question about includes. I know I could do pretty much all I want with sprocs and udfs but would like to avoid them for this task.
-
Yes you can include sql from a separate file. i do not recall the syntax oss the top of my head...
-
I notice that VS-DBPro uses
:r ..\Includes\SiteSetup.sql
But that doesn't seem to work in SQL-CLR project test scripts. -
PerfectPhase wrote:When I run a T-SQL script in SQL Management Studio, is there a way to do something along the lines of a #include? I have a large list of GUIDs that I currently have to cut and paste into each .sql file, there has to be a better way!
Thanks
Stephen.
Have you thought of putting your GUIDs in a text file and performing an OpenRowSet with Joins to the database data you want to use it with?
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.