I Think That My Question Is Simple.
How Can I Find That My Query Is Running From Where
( Where is The Location of the Script File itself ) ?
Edit :
Thank You For Your Answer.
I Need To Import a XML File Using my TSQL Script File And i want to Keep Them Together,
so Wherever Someone try to run the TSQL script file, it must knows the current directory of itself to know where is the XML file and then import it. Thank Again !
You need a well known location where you can place XML files for the server to load. This could be a share on the SQL Server machine, or on a file server which the SQL Server service account has permissions to read from.
You then need a comment like this at the top of your script:
Change
\\RemoteMachine\UploadShareto match the well known location you’ve selected. Optionally, have the comment followed by 30-40 blank lines (or more comments), so that it’s obvious to anyone running it that they might need to read what’s there.Then, write the rest of your script based on that presumption.