Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mavericky
Posting Yak Master
117 Posts |
Posted - 2011-01-20 : 13:09:13
|
| Hi All,In my c# code, I want to execute a sql statement by using Database.Read method. This method returns -1 instead of 0. Does it mean that something is definitely wrong with my stored proc? Thanks in anticipation,MaverickyBelow is stored proc:LTER PROCEDURE [dbo].[usp_APPL_InsUpdEntity] @ID INT=0, @Name VARCHAR (100)='', @ShortName VARCHAR (20)='', @Comments TEXT='' AS DECLARE @RID AS INT-- =============================================-- Description: Inserts/Updates Entity table-- Changes:-- 2010-12-07 / #119597 / AP / Created-- ============================================= IF EXISTS (SELECT * FROM [dbo].[VW_CR_OP_Entity] WHERE ID=@ID) BEGIN SET @RID = @ID UPDATE [dbo].[Entity] SET Name = @Name, ShortName = @ShortName, Comments = @Comments WHERE ID =@RID END ELSE BEGIN EXEC [CR_OP].[cr_operational].[dbo].GetNextIndex 'PK_Entity',@RID OUTPUT,1 INSERT INTO [dbo].[Entity] (ID, Name, ShortName, Comments) VALUES (@RID,@Name,@ShortName,@Comments) ENDBEGINSELECT @RID IDEND |
|
|
|
|
|
|
|