TSQL Function SQL Server 2012 - repost

This project received 14 bids from talented freelancers with an average bid price of $213 USD.

Get free quotes for a project like this
Employer working
Project Budget
$30 - $250 USD
Total Bids
Project Description


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?

Thank you

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online