Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
156 Points
135 Posts
Oct 18, 2010 05:51 PM|LINK
The Project_ID column should be, and is, an identity column which will create a new Project_ID if @pProjID = null.
The code snippet that you had listed IS part of my SP. I want to re-print this here:
If this SP worked perfectly in SQL Server 2000, why does this not return the ID value in SQL Server 2008?
CREATE proc dbo.hip_InsUpdProj ( @pProjId int, @pProjName varchar(255), @pProjDesc varchar(1000), @pProjNotes varchar(8000), @pProjDate datetime, @pProjType int ) as declare @RC int, @ROWS int begin if @pProjId = null begin insert into hip_Project (ProjectName, ProjectDesc, ProjectNotes, dtCreated) values (@pProjName, @pProjDesc, @pProjNotes, @pProjDate) end else begin update hip_Project set ProjectName = @pProjName, ProjectDesc = @pProjDesc, ProjectNotes = @pProjNotes, dtCreated = @pProjDate, deleted = @pProjType where Project_Id = @pProjId end select @RC = @@error if @RC <> 0 return @RC end --print SCOPE_IDENTITY() if @pProjId = null SELECT SCOPE_IDENTITY() as newProjectID else SELECT @pProjId as newProjectID return 0 GO
Is there something new in SQLServer 2008 that I need to account for in this SP?
NinjaSk8ter
Member
156 Points
135 Posts
Re: Object cannot be cast from DBNull to other types
Oct 18, 2010 05:51 PM|LINK
The Project_ID column should be, and is, an identity column which will create a new Project_ID if @pProjID = null.
The code snippet that you had listed IS part of my SP. I want to re-print this here:
If this SP worked perfectly in SQL Server 2000, why does this not return the ID value in SQL Server 2008?
Is there something new in SQLServer 2008 that I need to account for in this SP?