Capturing the OUTPUT from an Insert Sproc


Author
Message
Clayton Hoyt
Clayton Hoyt
StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)
Group: Forum Members
Posts: 40, Visits: 85
Hi Folks

The insert stored procs created by the DDT return  the SCOPE_IDENTITY value. How do I capture this using the .SAVE() method?

Thanks!

Clay

Reply
Wil Cantrell
Wil Cantrell
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 23, Visits: 129
How? What do you write in the stored proc?

Here is a brief example of the stored proc I'm using. Where do I get the value of @AutoIncrementField in my BO if it's not in the mapped field after a Save()?

ALTER  PROCEDURE [x].[myProc]
    @AutoIncrementField INT OUTPUT,
    @foreignkeyfield UNIQUEIDENTIFIER,
    @value1 INT,
 @value2 INT
AS
INSERT INTO [X].[myTable]
(
    foreignkeyfield
    value1,
    value2
)
VALUES
(
    @foreignkeyField,
    @value1,
    @value2
)
SET @AutoIncrementField = @@IDENTITY


____________________
Programmer/Analyst
Captain D's, LLC

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search