Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am planning to attach the application user name along with the connection string as follows
HTML
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
SQL
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
Updated 10-Apr-12 13:15pm
v2

1 solution

SQL
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
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900