 |
| SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 12th, 2004, 11:21 PM
|
|
Authorized User
|
|
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
how to know who edit add records?
hi guys,
i have column in my table for username and updtime ,i want to save the login name and date.time of this user if he edit/add a row in my table
how can i do it?
windows2003 ,security integrated with sql2000
m using vb.net
|
|

October 13th, 2004, 12:48 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Have a field for all and keep updating on the even.
at the Insert option u keep the field value as "A" and for edit as "E" and for delete "D".
Also filed like userID, updtDate, updtTime as to be updated on event.
Gokulan Ethiraj
|
|

October 13th, 2004, 01:16 AM
|
|
Authorized User
|
|
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi Gokulan Ethiraj,
tnx for reply but it doesnt solve my problem, can u pls elaborate more, or do u have any other suggestion,
waiting for ur help:)
|
|

October 13th, 2004, 02:04 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
How do you pick the login name? Is that the login that is used to connect to sql server or the one used in frontend app to get updated on to that table?
If you are looking to do that from the backend, then...
You may update the columns for username with the login info that comes along when the user tries to update and use getdate() for the other column that denotes update time. I don't see this done easier at the backend as the login information has to come from the frontend.
So I suggest, if you are looking for help related to doing that using VB.net, you may probably post that on a relavant .net forum here. This is SQL server related forum and not .Net.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

October 13th, 2004, 02:08 AM
|
|
Authorized User
|
|
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok, i see ur point, tnx anyway
|
|

October 13th, 2004, 03:43 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
additional
SUSER_SNAME(), - get windows login name
adding this to your column 'username' will default to use name who has log in to using windows authentication
Jaime E. Maccou
Applications Analyst
|
|

October 13th, 2004, 03:50 AM
|
|
Authorized User
|
|
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi jaime,
SUSER_SNAME(), - get windows login name
adding this to your column 'username' will default to use name who has log in to using windows authentication
sorry i really cant understand what u mean,
how do i use SUSER_SNAME(), in select statement? or pls elaborate
tnx for ur help,
waiting for ur respnse
|
|

October 13th, 2004, 04:14 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Please noticed change to spelling of user name.
SUSER_SNAME() is built in to SQL Server
1.You can use it by adding SUSER_SNAME() as a default for your table column default value.
2. using a select statement - SELECT SUSER_SNAME()
Example:
say you have columns
orderid
orderdate
Requireddate
username
select orderid,orderdate,requireddate,SUSER_SNAME()as username
from orders
Jaime E. Maccou
Applications Analyst
|
|

October 13th, 2004, 04:28 AM
|
|
Authorized User
|
|
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
tnx jaime :)
now i understand it, I'll try this tommorow in my ofc to run ur code,I'll update this to you what happen
|
|
 |