Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 USER_ID() behaves different helps pls

Author  Topic 

ram.marella
Starting Member

15 Posts

Posted - 2009-04-23 : 16:39:10
Hi,

I am using this function to get the curent connected user to the data base and based on that, if there is any insert/update then i am putting this user id information into table. Currently i saw that in one table the i am seeing two different user ids are updating. But at that i am sure that there is only batch will run whihc will use the sosbatch user name whic is not having the SA role.

please let me know why there two different user stamps for the same user?? when i execute beow stattements i am getting below results

select user_id()

select principal_id from sys.database_principals where name like 'sosbatch'

but in the table i am seeigng two usersstamp are updating table with 93 and 1 user ids. what is this user id :1 from where it is coming.

results
----

93
93

Thanks
-----------------
Ram MCP
   

- Advertisement -