Microsoft
Software
Hardware
Network
Question : Trigger Question
I have a database that gets inserts constantly. I need a trigger that when dbo.VisitorLog is inserted into, it will go out to dbo.Users and perform a SELECT query and find the UserID "dbo.Users.UserID" based on the newly inserted record and based on the GUID which is inserted automatically.
So example would be:
1) Insert happens: INSERT INTO dbo.VisitorLog (Name,UUID,Email) VALUES (Chris, 33cb6-c8b4-432d-b1fc-07082
b4383,
[email protected]
)
2) Fire Trigger to do a SELECT statement: SELECT UserID FROM dbo.Users WHERE UUID = '33cb6-c8b4-432d-b1fc-0708
2b4383'
3) Update the newly created record in dbo.VisitorLog with value from SELECT statement: UPDATE dbo.VisitorLog SET UserID =
Answer : Trigger Question
create trigger myTrigger on dbo.VisitorLog for update , insert as
update t1
set t1.userId = t2.userId
from dbo.VisitorLog t1 join inserted t2 on t1.UUID= t2.UUID
Random Solutions
Cognos Impromptu Catalog Question
How could I display the file extensions in the file explorer of windows mobile 6 ?
Windows Mobile, Visual Basic Need Code to Mimic MinimizeBox.Click
create a mirror of MS SQL table in Access or MYSQL
IIS 6 and ASP - How to create new website on IIS 6.0 from ASP page using a batch file. The file will not execute
TTrayIcon onBalloonClick
Urgent - Creating Word document - Ok in NT, Error in 2000
Reporting Services 2005 - Currency Format Style for fixed currency symbol
Validating dropdownlist cascading.
Cannot Create Mapped drive to shared folder