I have a SSRS report that I want to bring in the start & end date. No problem there. But I want to change the dates to the format of the field I am selecting by.
The field is called importid and starts with 98 then date CCYYMMDD and then 3. I figured I could create some variables and format the selection fields. But I keep getting errors that varchar data cannot be converted.
Here is is my code for converting the variables to the format.
DECLARE @StartImport bigint,
@EndImport bigint,
@Number varchar(11)
Set @Number = '98' + LEFT(@StartDate,8) + '3'
Set @StartImport = convert(bigint, @Number)
Set @Number = '98' + LEFT(@StartDate,8) + '3'
Set @EndImport = convert(bigint, @Number)