Hi,
In genral database what is the system function to get the current user's user id?
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 3, 2012, 6:06 AM EST
USER_ID(). other system functions like USER_NAME(), SYSTEM_USER, SESSION_USER, CURRENT_USER, USER, SUSER_SID(), HOST_NAME(). ThanksChintan RathodRank #516 · 4.8K reputationPosted Jan 3, 2012, 6:38 AM EST
When connected to SQL Server 2000, use:
Syntax
USER_ID ( [ 'user' ] )
Arguments
'user'
Is the username to be used. user is nchar. If a char value is specified, it is implicitly converted to nchar.
Return Types
smallint
Remarks
When user is omitted, the current user is assumed. Parentheses are required.
USER_ID can be used in the select list, in the WHERE clause, and anywhere an expression is allowed.
Examples
This example returns the identification number for user "Chintan".
Arjun PanwarRank #254 · 9.9K reputationPosted Jan 3, 2012, 9:17 AM EST