I am trying to convert a date parameter in my select statement but i wanted to format it and currently it is not accepting how i have it written — Any advice would be appreciated
SELECT @cases = COALESCE(@cases+ @linebreak + C.CaseNumber, C.CaseNumber)+"-"+CT.[Description]+"-"+CONVERT(VARCHAR,@assignment,100)AS A.DateOn
This is how i had it before the formatting and it was converting and working fine:
SELECT @cases = COALESCE(@cases+ @linebreak + C.CaseNumber, C.CaseNumber)+"-"+CT.[Description]+"-"+CONVERT(VARCHAR, A.DateOn)
Not sure if more information will be needed or not but let me know.
Guessing, your last bit should be
Where does @assignment come from? Your unformatted code doesn’t mention it…
Note (after question comment) 4/14/2010 is harder to do than 04/14/2010. You have to evaluate day, month and year separately to remove leading zeros