Click here to Skip to main content
12,253,114 members (56,968 online)
Rate this:
 
Please Sign up or sign in to vote.
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
appyks751
Edited 10-Apr-12 13:15pm
RaisKazi34.3K
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 11 Apr 2012
Copyright © CodeProject, 1999-2016
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