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 2000 Forums
 SQL Server Development (2000)
 Inserted Table

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 inserted

Michael

<Yoda>Use the Search page you must. Find answer you will.
Go to Top of Page

mikejohnson
Posting Yak Master

153 Posts

Posted - 2002-07-01 : 17:21:49
I get this error:

Invalid object name 'inserted'.

Go to Top of Page

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.



Go to Top of Page

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?

Go to Top of Page

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.."
Go to Top of Page

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.
Go to Top of Page
   

- Advertisement -