?
Solved

SQL Function to get attributes from a connectionstring

Posted on 2007-03-30
5
Medium Priority
?
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 18824131
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
ID: 18824160
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 2000 total points
ID: 18824181
select app_name()  --application name
select host_name()
select current_user
0
 

Author Comment

by:CAMSYSTEMS
ID: 18824187
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
ID: 18824242
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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

800 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