I am getting a date parameter value as '4-1-2009' from front end. Now I want to make it as
'4-1-2010' in my stored procedure. I am trying like below.
ALTER PROCEDURE [dbo].[SP_EMP]
@STARTDATE DATETIME,
@ENDDATE DATETIME,
@STARTDATE2 DATETIME,
SET @STARTDATE2=DATEADD(yy, 1, @STARTDATE)
AS
BEGIN
SELECT EMPNAME FROM EMP WHERE JOINDATE>@STARTDATE2
----// SOME JOINS //----
END
How can I do this? Please tell me.
Regards, N.SRIRAM
dateAdd function id the solution
SELECT DATEADD(year, 1, '4-1-2009') FROM UserLog
Or
Declare @E DATETIME,
SET @E=Select DATEADD(year, 1, '4-1-2009')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With