SQL Server 2008 - Trying to edit dates - Syntax Error? -


i have database has startdate , enddate. trying run simple script find , replace dates. here script:

set startdate = '2012-10-11 07:00' , enddate = '2012-10-13 20:00'  startdate = '2012-10-12 07:00' , enddate = '2012-10-14 20:00' 

i run , receive error:

incorrect syntax near '='.: set startdate => '2012-10-11 07:00' , enddate = '2012-10-13 20:00' startdate = '2012-10-12 07:00' , enddate = '2012-10-14 20:00' 

i have no idea why it's not running correctly, 1 of clever bod's here able point out incredibly dumb mistake!

here's hoping! =0)

you need separate columns update comma rather and:

update  yourtable set     startdate = '2012-10-11 07:00',         enddate = '2012-10-13 20:00'    startdate = '2012-10-12 07:00'  ,     enddate = '2012-10-14 20:00' 

you should use culture insensitive date format 'yyyymmdd hh:mm:ss', e.g. date 2012-10-11 07:00, interpretted 11th october cultures, , 10th november others.

example on sql fiddle of why not use yyyy-mm-dd dates


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -