December 5, 2005 at 9:58 am
HI, i was making a new table to get information of the people who changes some tables at work, it has something like this:
USUARIO VARCHAR(100) DEFAULT SUSER_SNAME(),
FECHA_AUDIT DATETIME DEFAULT GETDATE(),
HOST VARCHAR (50) DEFAULT HOST_NAME()
but i want the name of the application, who was used to make the changes, i found something about appName, but never says how to use it.
Can someone help me??
Marce
December 5, 2005 at 3:14 pm
This works:
create table appname_test (
USUARIO VARCHAR(100) DEFAULT SUSER_SNAME(),
FECHA_AUDIT DATETIME DEFAULT GETDATE(),
HOST VARCHAR (50) DEFAULT HOST_NAME(),
App varchar(50) DEFAULT APP_NAME()
 
insert into appname_test default values
select * from appname_test
December 5, 2005 at 6:30 pm
I presume you mean that you want to know what tool or application they are using to make their updates... was it Access, Excel, Sqlcmd, Enterprise Manager, Management Studio, etc. I can't identify how to do this; but someone here might be able to. I do not think what you meant was how to insert this information in a table; but rather, how to get it out from somewhere without having inserted it Good luck. Hope someone can help you.
December 5, 2005 at 7:37 pm
I will try this at work tomorrow: App varchar(50) DEFAULT APP_NAME()!!
Thanks a lot, (sorry for my english :$)
December 6, 2005 at 9:20 am
THANKS A LOT, IT WAS WHAT I NEEDED!
BYE
December 6, 2005 at 9:32 am
Yes, I tried the other one, by myself and yes it writes sql for the aplication, but when i put the trigger on the users table, all the changes was on MS SQLEM, so isn't what i need, because the users works at differents systems.
Well, if someone can help me i will aproache it!
Marce
December 6, 2005 at 10:02 am
Marce - I think this is what you're looking for...the program_name will give you the application via which the users are accessing the database...
select login_time, hostname, program_name, nt_username from sysprocesses order by login_time desc
**ASCII stupid question, get a stupid ANSI !!!**
December 6, 2005 at 11:31 am
it was working, the app_Name(), the appName gave the same info that de program_name in de systemprocess, but the program at the specific computer haven't the program name, it was just waste ??g?????d je je, so is ok, maybe is because they have win98 and I work with xp
December 6, 2005 at 6:16 pm
The appname is an optional parameter on your database connection string. If you are using a custom-written app, you need to pass this as part of your ODBC or OLEDB connection string. SQL doesn't have a way of magically determining the name of the client application. The HOSTNAME works the same way. The only client parameter that doesn't work this way (ie, I haven't seen a way to control it yet) is that SQL always seems to get the processID of the client app somehow...
In any case, you need to ensure your application connection strings set the application name parameter.
December 7, 2005 at 7:39 am
I get this, the host and the application
DNP-DP-27?g?????n?? (if they use windows 98)
DGA-DI-01 MS SQLEM - Data Tools (using XP)
some people at work need to use 98 because of a special program that only working at that OS.
I get into the SQL analyzer (working by analyzing SQL_TRACE) and i get the same ?g?????n?? (
December 8, 2005 at 4:53 am
Is it true that no matter what app they are running on '98 you get that same app name string?
OR, do you just get a rubbish app name string running that '98 only app?
If you run the application on different computers, or run it several times in a row on a single PC, do you get the same app name or a different set of rubbish characters each time?
December 9, 2005 at 6:41 am
When i get the app info from the sql trace, i get rubbish characters, from each application runing at the win98 users, but not xp users.
And the app info in the sql table gets only from one application, it says SIN if is a winxp and rubbish characters if win98.
December 9, 2005 at 11:05 am
The app name isn't something you can really depend on, though, because it is passed by the client and there is no verification of it by SQL Server (which raises the question, "How would SQL Server verify it?"). As a result, the app name is set by the app and can be anything the app sets it to, including complete rubbish. It can also be set in the DSN if the app uses that. For instance, the app name can be set in a DSN Microsoft Access uses. You won't see Microsoft Access as the app name when you look in SQL Server if you've set something in the DSN.
K. Brian Kelley
@kbriankelley
December 9, 2005 at 2:04 pm
Can i change the name that the app give to the sql??
December 9, 2005 at 2:44 pm
Yes, I talk about how to do so in this article (which is a general article on Profiler). Look for the section A Major Proviso:
K. Brian Kelley
@kbriankelley
Viewing 15 posts - 1 through 15 (of 20 total)
You must be logged in to reply to this topic. Login to reply