i have long sql query converts numeric date data type date time value , further specifies search based on requirements. receiving couple of errors cannot seem around , wondering if can make modification query run error free.
this query:
select [object] [dataset], cast(dateadd(hour,-4,convert(datetime,left([date],8)+' '+ substring([date],10,2)+':'+ substring([date],12,2)+':'+ substring([date],14,2)+'.'+ substring([date],15,3))) date) 'date', left(cast(dateadd(hour,-4,convert(datetime,left([date],8)+' '+ substring([date],10,2)+':'+ substring([date],12,2)+':'+ substring([date],14,2)+'.'+ substring([date],15,3))) time),8) 'time', msgid, parms, case when msgid = '61' substring(parms,35,6) else '' --optional else end [dataset], ( select itemid, convert(varchar(18),[date]) [date], [object], msgid, parms, jnldatasection cast(substring(convert(varchar(50), [date]), 0, 5) + '-' + substring(convert(varchar(50), [date]), 5, 2) + '-' + substring(convert(varchar(50), [date]), 7, 2) datetime) = convert(date, dateadd(day, -1, getdate()))) --converting date again remove time part substring(parms,35,6) = 'x05219' order [date] desc;
these errors:
msg 156, level 15, state 1, line 17 incorrect syntax near keyword 'from'. msg 156, level 15, state 1, line 22 please note: i'm using sql server management studio 2008 incorrect syntax near keyword 'from'.
you have comma before from:
end [dataset],
should be
end [dataset]
Comments
Post a Comment