February 6, 2006 at 7:48 am
Hello everyone,
Very simple stored procedure, minus the code to create the procedure, etc...
tbl_Positions consists of:
pk_PositionID int, not null, primary key, identity
RO int, not null
Position varchar(30), not null
< begin sp code >
@command varchar(10),
@pk_PositionID int,
@Position varchar(30)
as
BEGIN
if @command = 'insert'
Begin
set nocount on
Declare @NextRO int
set @NextRO = (select Max(RO) from tbl_Positions)
if @NextRO = null
set @NextRO = 1
else
set @NextRO = (@NextRO + 1)
insert into tbl_Positions(RO,Position) values(@NextRO,@Position)
end
END
< end sp code >
This works perfectly in SQL 2000, but not in 2005. Can someone please explain why before I pull the rest of my hair out?!
TIA,
Brandon
February 6, 2006 at 8:20 am
One possible reason is ANSI_NULLS setting is different between 2000 and 2005 when the SP is created becuase you used @NextRO = null
Try to change it to @NextRO IS NULL
February 6, 2006 at 8:56 am
Perfect! Taking out ANSI_NULLS and changing = null to is null works.
Thank you SOOOOO much!
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply