Author |
Message |
judahr
Joined: 09 Mar 2007 Posts: 319 Country: United States |
|
Set @Var = Scope_Identity() adds INTO |
|
v 3.5.21 SSMS
Set @Var = SCOP
Hit enter to select Scope_Identity()
Outputs:
Set @Var = INTO SCOPE_IDENTITY
Should be:
Set @Var = Scope_Identity() -- ideally
or
Set @Var = Scope_Identity --if you must.
|
|
Thu Jun 26, 2008 4:08 pm |
|
 |
judahr
Joined: 09 Mar 2007 Posts: 319 Country: United States |
|
|
|
Might be caused by my Insert statement that doesn't have an INTO, although it is otherwise complete. Set statement is after a closed Values clause.
CONFIRMED. It tries to add INTO to anything if Insert statement doesn't have it.
|
|
Thu Jun 26, 2008 4:09 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7955
|
|
|
|
I'm not sure I understand the issue. If I open new query editor and paste your code as is I don't get and I don't expect to get a popup after SCOP. There must be something above the referenced line that is causing a different effect.
|
|
Thu Jun 26, 2008 4:54 pm |
|
 |
judahr
Joined: 09 Mar 2007 Posts: 319 Country: United States |
|
|
|
You need an Insert statement above without an INTO:
Declare @id int
Insert dbo.Table1(column1) values(@Column1)
Set @id = Scop
|
|
Thu Jun 26, 2008 5:25 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7955
|
|
|
|
Got it
 |
 |
Declare @id int
Insert dbo.Table1(column1) values(@Column1)
Set @id = INTO SCOPE_IDENTITY |
I will talk to our developers and check what they can say about this issue, whit the application attempts to complete INSERT syntax but does it in a wrong place.
|
|
Thu Jun 26, 2008 5:31 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7955
|
|
|
|
This behavior will be corrected in the next maintenance release, which we expect to be available by the end of the week or sooner.
|
|
Tue Jul 01, 2008 12:36 pm |
|
 |
|