scope-identity Questions
6
Solved
I have a handful of raw SQL queries for SQL Server which use SCOPE_IDENTITY to retrieve the generated ID for a specific INSERT immediately after that INSERT occurs all in one execution…
INSERT int...
Elmoelmore asked 5/4, 2011 at 21:49
5
Solved
So I have a table with an identity column as the primary key, so it is an integer. So, why does SCOPE_IDENTITY() always return a decimal value instead of an int to my C# application? This is really...
Moonstone asked 8/4, 2010 at 16:20
7
Solved
I know this question has been on this site many times, but I can't get my code working.
I have an Insert statement, and I need the id from that statement on my asp.net page.
I'm getting the retur...
Unplumbed asked 20/2, 2015 at 10:47
3
Solved
So Scope_Identity() returns an ?-Byte Numeric Type in SQL Server.
That is not awesome.
Is there a safe way to cast it to an int in a select query so we don't have to manage every whim of SQL Se...
Dharma asked 16/6, 2009 at 14:28
1
Solved
I am using SQL Server 2008 R2 Profiler to debug an issue on a ColdFusion 7 application - that was developed by someone else - running on Windows 7 with SQL Server 2008 R2 as a backend. The applicat...
Bimetallism asked 20/10, 2015 at 17:10
1
Solved
I am using an INSTEAD OF insert trigger on a table to set an incrementing version number on the row and also copy the row to a 2nd history/audit table.
The rows are inserted to both tables without ...
Leavy asked 18/3, 2015 at 7:14
1
In SSIS, I am able to make an insert of rows and retrieve their SCOPE_IDENTITY using OLE DB Command Task which calls stored procedure, but this is not bulk insert, it's slow load. Is it possible to...
Desperate asked 18/2, 2015 at 12:6
3
I am building a dynamic insert statement within a stored procedure.
I build up the sql syntax in a variable and then execute it with EXEC(@VarcharVariable).
The SQL insert works fine but when I...
Vichy asked 6/9, 2012 at 13:21
5
Can anyone tell me if there is an equivalent of SCOPE_IDENTITY() when using GUIDs as a primary key in SQL Server?
I don't want to create the GUID first and save as a variable as we're using sequen...
Livelihood asked 2/10, 2009 at 14:42
1
Solved
I have following table structure, for convenience purpose I am only marking individual columns
Table_A (Id, Name, Desc)
Table_1 (Id this is identity column, Name....)
Table_2 (Id this is identity...
Pythia asked 24/6, 2013 at 21:45
1
I will import many data rows from a csv file into a SQL Server database (through a web application). I need the auto generated id value back for the client.
If I do this in a loop, the performance ...
Latinist asked 15/11, 2012 at 14:28
2
Solved
I have PK that is self incrementing key. I need to insert the record into the database and then get that PK back and use it in another insert.
However I would like to do this in one transaction. I...
Yemane asked 10/10, 2012 at 20:8
2
Solved
I am a little stuck with why I can not seem to get the 'new identity' of the inserted row with the statement below. SCOPE_IDENTITY() just returns null.
declare @WorkRequestQueueID int
declare @Las...
Bergamo asked 2/10, 2012 at 21:11
4
I'll give a pseudocode example of my current method and if anyone knows of a method that doesn't work one row at a time, I'd be quite appreciative. I'm using MS SQL Server 2008.
define cursor for t...
Stoltzfus asked 14/7, 2010 at 18:7
6
Solved
I have a stored procedure that does, among other stuff, some inserts in different table inside a loop. See the example below for clearer understanding:
INSERT INTO T1 VALUES ('something')
SET @My...
Forwarder asked 15/3, 2010 at 10:20
1
© 2022 - 2024 — McMap. All rights reserved.