Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Issues with Trigger

Author  Topic 

GG
Starting Member

1 Post

Posted - 2009-10-06 : 05:11:15
Do you know of a way of doing this.

In a trigger, the row to be updated are given in the temp table "inserted"

I want to say something like this in the instead of trigger:

Update tracking
Set audit=xx, [rest]=[inserted.*]
From tracking t
Inner join inserted I on i.jobid = t.jobid

Get the idea? I want all existing items of inserted to be used, but I want to change the value of one field only

I am stuck, can some one pelase help

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-10-06 : 05:31:36
you have to specify the column name one by one. There is no shortcut

Update t
set col1 = i.col1,
col2 = i.col2,
. . .
from tracking t
inner join inserted i on t.jobid = i.jobid



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -