Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL2000 SQL-server-2005 , +
I am planning to attach the application user name along with the connection string as follows
Application Name=MyApplicationUserName;Data Source=ServerName; Initial Catalog=DatabaseName; Integrated Security=SSPI; 
So that I could set up default value rather than sending it from the front-end
CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
InsertedBy varchar(255) DEFAULT  APP_NAME()
)
Please advise if there's any better way of doing it.
 
ThanX in advance
Posted 10-Apr-12 8:37am
appyks634
Edited 10-Apr-12 13:15pm
RaisKazi32.8K
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName nvarchar(255) NOT NULL,
FirstName nvarchar(255),
Address nvarchar(255),
CreatedBy int,
CreatedOn datetime DEFAULT getdate(),
UpdatedBy int,
UpdatedOn datetime 
)
 

By doing this you can track the user (when multiple user have access to the same page) if it gets updated.
 

Regards,
Ashish
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 235
1 Sergey Alexandrovich Kryukov 120
2 Richard MacCutchan 100
3 kbrandwijk 85
4 Vinay Mistry 70
0 Sergey Alexandrovich Kryukov 9,056
1 OriginalGriff 8,041
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 11 Apr 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100