I have a script task where I change the connection string for db, however it does not contain one important piece of information, which is the server on which the package itself is running.
Is there a way to get the server name from a C # script?
I know that in sql I can select @@ servername, but I need a package to check the name of the server it is running on (dtsx) on which the sql server is not located.
I know this is a strange request, but there are many options, here are the ones that I am currently studying:
+Through A Batch CMD whose results i could store in a pkg level variable +Through ac# script +SQL if it is possible
any other ways anyone knows about would be greatly appreciated.
EDIT / UPDATE: I found several ways to do this:
C#: public string host = System.Environment.MachineName.ToString(); cmd: hostname ...-->then store in pkg variable
source share