I have a this stored procedure to which the year and month Number is pass as integer
For the SQL within that stored procedure, using the input month and Year (which is in integer data type), I need to derive a DATE as first day of that input month and year.
CREATE PROCEDURE test (@i_Year INT, @i_Month INT)
DECLARE @v_date DATE;
SET @v_date = <need to assign 1st day of the input month/year i.e, '20140101'>
Input values passed to the stored procedure:
@i_Year = 2014
@i_Month = 1
Below is what I figured out:
But is there a better way to achieve this?
Is there a date function which would take month and year, and return me the first day in that month/year, and also the value should be of type DATE?