Solved

sql server default value to be currently logged in user

Posted on 2010-11-26
2
465 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 143

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

820 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