Solved

SQL Function to get attributes from a connectionstring

Posted on 2007-03-30
5
170 Views
Last Modified: 2010-08-05
Is there anyway that SQL Server 2005 can get information contained within the ConnectionString that was used to connect to the database for use in a trigger.

For example, if I have an application that uses the ConnectionString...
"server=(local); database=test; user=sa; pwd=testing; applicationname=myprogram"

how can I get out the applicationname attribute???
0
Comment
Question by:CAMSYSTEMS
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:YZlat
Comment Utility
what exactly are you trying to do here??

From what I can see so far, you can't do that
0
 
LVL 35

Expert Comment

by:YZlat
Comment Utility
what exactly are you trying to do here??

From what I can see so far, you can't do that
0
 
LVL 10

Accepted Solution

by:
ksaul earned 500 total points
Comment Utility
select app_name()  --application name
select host_name()
select current_user
0
 

Author Comment

by:CAMSYSTEMS
Comment Utility
All I want to do is to be able to extract the applicationname attribute from the connectionstring that has been used to connect to the database from within SQL Server 2005???
0
 
LVL 10

Expert Comment

by:ksaul
Comment Utility
I would create a SQL login specific to the application instead of using sa and assign it permissions required by the app.  Then you could know that the value returned by current_user is your application.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now