Thanks, Ben I was not aware of that. Unfortunately, it does seem new to SQL Server 2000, at least I don't see anything about it in books online fot MSSQL7. Good tip though.
</rob> -----Original Message----- From: Ben Johnson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 21, 2002 11:21 AM To: CF-Talk Subject: RE: Query help If you're using SQL Server, it's not always good practice to use @@IDENTITY. Instead, use SCOPE_IDENTITY(). SCOPE_IDENTITY() is the same as @@IDENTITY, except it limits the scope. For example, if you insert a row into TableA, but that table has an insert trigger that does some processing and inserts into another table called TableB, you'll pull the ID for TableB. SCOPE_IDENTITY() always pulls the most recent identity within scope for the current session, which means you don't need to worry about triggers. Granted, not a lot of people use triggers, but it's still good practice. Also, SCOPE_IDENTITY() may have been recently added. It may be a SQL Server 2000 feature so if you're using anything prior, you may be out of luck. Anybody else know if this is new to SQL Server 2000? Ben Johnson Hostworks, Inc. ______________________________________________________________________ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

