Solved

sql server default value to be currently logged in user

Posted on 2010-11-26
2
457 Views
Last Modified: 2012-05-10
How can i set the sql server default value for a column to be the value of the currently logged in user?
0
Comment
Question by:NormanMaina
2 Comments
 
LVL 16

Accepted Solution

by:
EvilPostIt earned 250 total points
ID: 34217570
use the system_user function as the default value.
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 34217575
you want either the user name (relevant to the db): USER_NAME()
http://msdn.microsoft.com/en-us/library/ms188014.aspx

or the login name: SUSER_NAME()
http://msdn.microsoft.com/en-us/library/ms187934.aspx
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now