CREATE PROCEDURE CompareDate
@.CurrentDate datetime
AS
SELECT * FROM Contracts WHERE EndDate LIKE (CURRENT SERVER DATE)
GO
How do I declare a parameter to automatically get the current server date in the stored procedure? Also, once it is declared how can I add Months to it? For example this job is executed monthly and is supposed to select contracts that expire 2 months from the current month. So once I get the current server date, how do I add 2 months to the date in the stored procedure? Thanks very much in advance!!!Use getdate() function to get the current server date.
No comments:
Post a Comment