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
 Transact-SQL (2000)
 Scope_Identity() in Instead of Insert Trigger

Author  Topic 

lylefernquist
Starting Member

1 Post

Posted - 2006-08-07 : 18:47:19
We have existing applications that use SCOPE_IDENTITY() to return the identity value for inserted rows.

We wish to encrypt the password on our Users table by renaming the table to Users_Encrypted and creating a view named Users.

An INSTEAD OF INSERT trigger has been applied to the view. However, SCOPE_IDENTITY() returns null because we are inserting into the Users_Encrypted table, which places the insert out of the scope of the view Users.

We need to make this change without changing the application code, which is why we are attempting this maneuver.

Any suggestions on how we could accomplish this while retaining the SCOPE_IDENTITY() functionality will be greatly appreciated.

Lyle Fernquist

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-08-07 : 19:38:21
you'll have to use @@identity in this case.



-ec
Go to Top of Page
   

- Advertisement -