Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning Identity after Insert
Message
From
17/09/2005 06:48:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
16/09/2005 16:17:15
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
ASP.NET
Database:
MS SQL Server
Miscellaneous
Thread ID:
01050383
Message ID:
01050564
Views:
12
Bonnie,
You got me wrong. I didn't mean SCOPE_IDENTITY from within procedure. Try querying SCOPE_IDENTITY after SP call. You get null. As I said from within procedure you don't even need SCOPE_IDENTITY directly check what you inserted.
Anyway,I tried to mean one should know very well what he is doing if using IDENTITY.
Cetin

>>>PS: Warning if inserting via a stored procedure than SCOPE_IDENTITY wouldn't work. However you could query directly:<
>
>I just wanted to comment on this Cetin. SCOPE_IDENTITY with a Stored Proc works just fine. You'd set an OUTPUT parameter to the SCOPE_IDENTITY value.
>
>~~Bonnie
>
>
>
>
>>>I have an application in Asp.Net that writes to a SQL Server table. This SQL Server table has an Identity column.
>>>
>>>How can I return the value of the Identity column after performing an Insert into the table?
>>>
>>>Thanks,
>>>
>>>Jerry
>>
>>Jerry,
>>You would request SCOPE_IDENTITY back. Instead I suggest you to use GUID as unique IDs. You don't need to request back then because you know them before inserting.
>>PS: Warning if inserting via a stored procedure than SCOPE_IDENTITY wouldn't work. However you could query directly:
>>select IDENTCOLUMN from inserted
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform