Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

default value of username 1

Status
Not open for further replies.

jmeckley

Programmer
Jul 15, 2002
5,269
US
I would like to make the default value of a field the user's username. This is my first assignment working with SQl Server 2000. In Access I could set the default value to '=environ("username")'. I have quickly learned that this does not work in SQL 2K.

I am building the app in ASP.NET for internal use only. I think the most effecient way to get the info is through a default vaule assigned to the column or a trigger that would insert the username and date/time into their respective fields.

I got the datetime to work using the getdate() function. Any ideas on how to go about capturing the username? Thank you for your assistance

Jason Meckley
Database Analyst
WITF
 
Hi,

Set the default value of the field to suser_sname(). Havea look at BOL (Books Online) for more info

Sunil
 
when you say BOL do you mean generic web site tutorials or a specific webpage that most DBA's find informative? Thank you for your assistance

Jason Meckley
Database Analyst
WITF
 
Books Online is the SQL help that comes with SQL Server. YOu can find it by cliking the help button in ENterprise Manager.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top