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.
Author |
Topic |
mikejohnson
Posting Yak Master
153 Posts |
Posted - 2002-07-01 : 17:14:10
|
What is the syntax for accessing a fields from the inserted table? Isn't it something like 'select field1 from @@inserted'? |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-07-01 : 17:18:03
|
select field1 from insertedMichael<Yoda>Use the Search page you must. Find answer you will. |
|
|
mikejohnson
Posting Yak Master
153 Posts |
Posted - 2002-07-01 : 17:21:49
|
I get this error:Invalid object name 'inserted'. |
|
|
DGMelkin
Starting Member
24 Posts |
Posted - 2002-07-01 : 18:01:55
|
the "inserted" table only exists within the context of the trigger. So inside your trigger, you can treat it like any other temp table. But it's gone as soon as the trigger is done. |
|
|
mikejohnson
Posting Yak Master
153 Posts |
Posted - 2002-07-01 : 18:03:13
|
i can't use the inserted table just in a regular sp? |
|
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2002-07-01 : 18:13:09
|
mike,The scope of the Inserted table is very tight.. The trigger is it's life span...DavidM"SQL-3 is an abomination.." |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-07-01 : 18:51:53
|
Mike, can you show us your stored proc, so that we can see what you are trying to accomplish?My bet is that you are trying to figure out what Identity value you just inserted. Look up @@IDENTITYor SCOPE_IDENTITY in BOL. SCOPE_IDENTITY is for SQL 2000 only.Michael<Yoda>Use the Search page you must. Find answer you will. |
|
|
|
|
|