I need to create a date string then do a test against it with another date within a SQL Stored Procedure. So I am first of all extracting the Year I want into a variable called @FinancialYr then need to set a date of 1/4/@FinancialYr.
My existing code is;
set @FinancialYrStart = cast(("01/04/"&@FinancialYr) as datetime)
print convert(datetime, @FinancialYrStart)
The second line is where I am trying to view the result. I am getting an error ;
"Syntax error converting the varchar value '01/04/' to a column of data type int."
Can anyone give me an idea where the syntax is falling down ?