I need someone to write a TSQL function that returns the name of the ODBC DSN for a given connection.
I can use the queries below, to get information about the connection, but none of these return the DSN name for example.
1. select * from sys.dm_exec_connections
2. select * from sysprocesses
3. select connectionproperty('net_transport')
4. select connectionproperty('protocol_type')
This link shows the C# class that may be able to return this information.
[url removed, login to view]
So if ...
I use a client to connect to SQL Server using odbc connection with a DSN name of ConnectionA and
YOU use a client to connect to the same SQL Server using odbc connection with a DSN name of ConnectionB,
when you run
you should get "ConnectionB"
and when I run
I should get "ConnectionA"...
I am NOT looking for stored procedures like sp_enumdsn or sp_dsninfo...
I only say this as some of the developers here have been suggesting this kind of answers..
So to be clear, I am looking to find out what the CLIENT DSN name was, that the connection is using.
I am NOT looking for DSNs defined on the SERVER.
Could you quote for writing this function (dbo.ufn_GetODBCDSN() ) that I can use from TSQL code that returns the name of the DSN?