Home Forums SQL Server 2008 T-SQL (SS2K8) Conversion failed when converting the varchar value '201ex' to data type int. RE: Conversion failed when converting the varchar value '201ex' to data type int.

  • Thanks for your feedback. you can also change your following query:

    SELECT RIGHT('00' + CONVERT(VARCHAR(2), Datepart(month, Getdate())), 2)

    + RIGHT('00' + CONVERT(VARCHAR(2), Datepart(day, Getdate())), 2)

    + RIGHT('0000' + CONVERT(VARCHAR(4), Datepart(year, Getdate())), 4)

    + RIGHT('00' + CONVERT(VARCHAR(2), Datepart(hour, Getdate())), 2)

    + RIGHT('00' + CONVERT(VARCHAR(2), Datepart(minute, Getdate())), 2)

    + RIGHT('00' + CONVERT(VARCHAR(2), Datepart(second, Getdate())), 2) AS RequestTimestamp

    to something smaller like this:

    SELECT Replace(CONVERT(VARCHAR(20), Getdate(), 101), '/', '')

    + Replace(CONVERT(VARCHAR(20), Getdate(), 108), ':', '') AS RequestTimestamp