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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Can any one see what's wrong with my update Query?

Author  Topic 

sqlontherun101
Starting Member

16 Posts

Posted - 2009-11-15 : 11:30:50
Hi Friend,

I have written a Stored procedure to perform an update operation on tblDesignation but it doesnt update... i cant see the problem as it seems there is no logical error in the structure...

here is my stored procedure


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ProcUpdateDesignation]
(
@Name nvarchar(50),
@AnnualLeaveMax int,
@SickLeaveMax int,
@EntryDate datetime,
@UpdatedDate datetime,
@Original_DesigIndex int,
@Original_Name nvarchar(50),
@Original_AnnualLeaveMax int,
@Original_SickLeaveMax int,
@Original_EntryDate datetime,
@Original_UpdatedDate datetime
)
AS
SET NOCOUNT OFF;
UPDATE [tblDesignations]
SET
[Name] = @Name,
[AnnualLeaveMax] = @AnnualLeaveMax,
[SickLeaveMax] = @SickLeaveMax,
[EntryDate] = @EntryDate,
[UpdatedDate] = @UpdatedDate
WHERE
(
[DesigIndex] = @Original_DesigIndex
AND
[Name] = @Original_Name
AND
[AnnualLeaveMax] = @Original_AnnualLeaveMax
AND
[SickLeaveMax] = @Original_SickLeaveMax
AND
[EntryDate] = @Original_EntryDate
AND
[UpdatedDate] = @Original_UpdatedDate
)

I have uploaded the DB and you can downlaod it from the followin link

[url]http://www.mediafire.com/?t3iojnd2mmx[/url]


I'm uinsg SQL server 2K5 Express i've used the SQL server Management studio express's right click to stored procedure and run utility. according to it my stored procedure doesnt updte


Thanks

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-11-15 : 22:18:02
Would need to know what values are passed in. Also, might as well remove the set nocount off.

most likely, the parameters passed in dont match any records in the table.

you can test it by writing a select statement with the same criteria
Go to Top of Page
   

- Advertisement -