|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, January 29, 2013 5:26 AM
Points: 8,
Visits: 138
|
|
Hi everyone,
Can any one tell me how to determine the file path of an open SQL file in the management studio?
I am trying to run an update script which open other SQL files. These update files (and folders) will always be relative to the update script which could be installed to different locations; so what I want is to be able to determine the path of the update file being opened, so that variables do not need to be manually set.
Many thanks for everyone's help.
Laurence.
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 3:36 AM
Points: 721,
Visits: 1,330
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, January 29, 2013 5:26 AM
Points: 8,
Visits: 138
|
|
Thanks for the reply.
I know you can obtain the file path from looking at the tab. I want to be able to obtain the file path using TSQL within the script. It needs to be automatic.
Many thanks,
Laurence
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 4:46 PM
Points: 1,287,
Visits: 3,850
|
|
<disclaimer> I don't even want to think about the security implications of what you are doing, so I will leave that to you</disclaimer>
Have you thought about using sqlcmd instead of ssms?
It can read files into the query stack using the ":r" command - and it uses relative paths ...
MM
|
|
|
|