Getting problem in comparison

  • Hi,

    Could you please help to sort out comparison problem

    DECLARE @TIMESTAMP varchar(30)='EventTimestamp'

    DECLARE @Wkstr1 NVARCHAR(30)=CAST('Sep 28 2015 12:00AM' AS DATE)

    When i take the print of below statement

    WHEN CAST(A.'+@TIMESTAMP+' AS DATE) >= CAST('+@Wkstr1+' AS DATE)

    it gives like below

    WHEN CAST(A.EventTimestamp AS DATE) >= CAST(2015-09-28 DATE)

    but i need

    WHEN CAST(A.EventTimestamp AS DATE) >= CAST('2015-09-28' DATE)

  • Got the solution.. leave it..

    solution is like below

    WHEN CAST(A.'+@TIMESTAMP+' AS DATE) >= CAST('''+@Wkstr1+''' AS DATE)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply