You are here: Return from store procedure. « MsSQL Server « IT news, forums, messages
Return from store procedure.

Posted by vassone on 10/19/03 11:26

Dear All, I read through all the post and flipped through the books but I
still can't find the answer to my problem.

I'm inserting a new record via a stored procedure and want to return the id
via scope_identity, which I thought would be preety straight forward.

The code I'm using is below and this keeps giving me "Multiple-step OLE DB
operation generated errors. Check each OLE DB status value, if available. No
work was done."

How do I pick the returning id value and could anyone see were I'm going
wrong below.

Many thanks for any help you can offer.

CREATE PROCEDURE [sp_insert_address]


@ADDR_NAME_2 [char](70),
@ADDR_NO_3 [char](10),
@ADDR_ROAD_4 [char](50),
@ADDR_DISTRICT_5 [char](50),
@ADDR_TOWN_6 [char](50),
@ADDR_BOROUGH_7 [char](50),
@ADDR_PCODE_8 [char](12),
@addr_id [int] OUTPUT


AS INSERT INTO [HEAPADLive].[dbo].[TBL_ADDR]
(
[ADDR_NAME],
[ADDR_NO],
[ADDR_ROAD],
[ADDR_DISTRICT],
[ADDR_TOWN],
[ADDR_BOROUGH],
[ADDR_PCODE])


VALUES
(
@ADDR_NAME_2,
@ADDR_NO_3,
@ADDR_ROAD_4,
@ADDR_DISTRICT_5,
@ADDR_TOWN_6,
@ADDR_BOROUGH_7,
@ADDR_PCODE_8)

set @addr_id = scope_identity()
GO

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация