I have an input date and I need to convert it to format 112 (yyyymmdd) for use later on in my SQL statement.
declare @day varchar(10)
set @day = '6/21/2013'
I would convert it to a
datetime first, then to the format that you want:
declare @day varchar(10) set @day = '6/21/2013' select convert(varchar(10), cast(@day as datetime), 112);