• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

SQL Function to get attributes from a connectionstring

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
CAMSYSTEMS
Asked:
CAMSYSTEMS
  • 2
  • 2
1 Solution
 
YZlatCommented:
what exactly are you trying to do here??

From what I can see so far, you can't do that
0
 
YZlatCommented:
what exactly are you trying to do here??

From what I can see so far, you can't do that
0
 
ksaulCommented:
select app_name()  --application name
select host_name()
select current_user
0
 
CAMSYSTEMSAuthor Commented:
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
 
ksaulCommented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now