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
 Reg. Update statement

Author  Topic 

vmurali
Yak Posting Veteran

88 Posts

Posted - 2007-02-21 : 08:55:42
Hi,
In my stored procedure I have a parameter @empcode varchar(20)

can anyone tell me how to make use of this parameter
my update statement is like
update leave_table set leave_days_=20 where Emp_code='@empcode'
Is the above statement correct. If not please correct it

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-21 : 08:57:35
CREATE PROCEDURE dbo.uspUpdateLeaveDays
(
@Emp_Code VARCHAR(20)
)
AS

SET NOCOUNT ON

UPDATE Leave_Table
SET Leave_Days = 20
WHERE Emp_Code = @EmpCode


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

vmurali
Yak Posting Veteran

88 Posts

Posted - 2007-02-21 : 09:03:31
Is there no need to give @EmpCode in quotes as it is varchar.
will this work if empcode is like INC345

quote:
Originally posted by Peso

CREATE PROCEDURE dbo.uspUpdateLeaveDays
(
@Emp_Code VARCHAR(20)
)
AS

SET NOCOUNT ON

UPDATE Leave_Table
SET Leave_Days = 20
WHERE Emp_Code = @EmpCode


Peter Larsson
Helsingborg, Sweden

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-21 : 09:12:18
Try first, ask again later...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -