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)
 Returning the IDENTITY of the inserted column

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-15 : 11:02:37
Tony writes "Hello,
I have looked around your site quite a bit and first let me say very impressive - second let me say that if this has already been answered just point me in the right direction and sorry for wasting your time.
What I want to do is simple and in a ideal world I could add "return article_id" to the end of the insert statement but know that won't work (Hmm actuall I haven't tried it - but I am pretty sure it won't work!) Anyway I want to insert a record to a table and then insert a record in another table related to the first, so I need the ID of the first inserted record - but I don't want to have to do another Database call - the calls are being made from a asp page on the web so performance is an issue - is there any easy way to do this - I presume a stored procedure will be requiered but I would ove if I could modify my SQL to do it!! - here is the insert statement pretty standard but just for the record:
Insert into article(article_name,author,date,abstract)
Values
('SQL Team.com','tony','09/09/01','short abstract from the article')
I am using Windows NT with SP6 and SQL Server 7

Thanks in advance
Your humble student
Tony O Sullivan"
   

- Advertisement -