S
Sandy
Hi
I have been given a rather hairy piece of sql to put into a module but I
have not been able to properly convert it to SQL that access can process.
Can anyone help with this?
The sql is:
update cdb_data a from cdb_description b set item_date =
date(varchar(b.start_year)+'.1.1') + date(varchar(b.start_period-1)+'
days') - date(varchar((locate('Mon Tue Wed Thu Fri
',dow(date(varchar(b.start_year)+'.1.1')+ date(varchar(b.start_period-1)+'
days'))))/4)+' days') + date(varchar(((a.period-1+(locate('Mon Tue Wed Thu
Fri ',dow(date(varchar(b.start_year)+'.1.1')+
date(varchar(b.start_period-1)+' days')))/4))/5)*7) + 'days') +
date(varchar(mod((a.period-1+(locate('Mon Tue Wed Thu Fri ',
dow(date(varchar(b.start_year)+'.1.1')+date(varchar(b.start_period-1)+'
days')))/4)),5)) + ' days') where a.identifier = b.identifier And
b.periodicity = 366 and b.data_type = 1 and a.item_date = '';
I think that 'locate' needs to change to 'instr' and 'date' needs to change
to 'day' but try as I might, I am not having much success with converting
the sql.
Thanks in advance
Sandy
I have been given a rather hairy piece of sql to put into a module but I
have not been able to properly convert it to SQL that access can process.
Can anyone help with this?
The sql is:
update cdb_data a from cdb_description b set item_date =
date(varchar(b.start_year)+'.1.1') + date(varchar(b.start_period-1)+'
days') - date(varchar((locate('Mon Tue Wed Thu Fri
',dow(date(varchar(b.start_year)+'.1.1')+ date(varchar(b.start_period-1)+'
days'))))/4)+' days') + date(varchar(((a.period-1+(locate('Mon Tue Wed Thu
Fri ',dow(date(varchar(b.start_year)+'.1.1')+
date(varchar(b.start_period-1)+' days')))/4))/5)*7) + 'days') +
date(varchar(mod((a.period-1+(locate('Mon Tue Wed Thu Fri ',
dow(date(varchar(b.start_year)+'.1.1')+date(varchar(b.start_period-1)+'
days')))/4)),5)) + ' days') where a.identifier = b.identifier And
b.periodicity = 366 and b.data_type = 1 and a.item_date = '';
I think that 'locate' needs to change to 'instr' and 'date' needs to change
to 'day' but try as I might, I am not having much success with converting
the sql.
Thanks in advance
Sandy