song2siren
Programmer
Hello
I'm trying to convert a column (JudgementDate) in a SQL database (JPL_FLO_Index_copy) from varchar to smalldatetime. The dates, for example, need to be converted from 1 July 2003 to 01/07/2003. Some of the rows however, have a <NULL> value.
I've tried things along the following lines without success:
alter table JPL_FLO_Index_copy
add tempDate smalldatetime
update JPL_FLO_Index_copy
set tempDate = cast(JudgementDate as smalldatetime), JudgementDate = isnull
(judgementDate, '1900-01-01')
alter table JPL_FLO_Index_copy
alter column JudgementDate smalldatetime
update JPL_FLO_Index_copy
set JudgementDate = tempDate
alter table JPL_FLO_Index_copy
drop column tempDate
I'm sure this is fairly simple, but any help/suggestions would be very much appreciated.
I'm trying to convert a column (JudgementDate) in a SQL database (JPL_FLO_Index_copy) from varchar to smalldatetime. The dates, for example, need to be converted from 1 July 2003 to 01/07/2003. Some of the rows however, have a <NULL> value.
I've tried things along the following lines without success:
alter table JPL_FLO_Index_copy
add tempDate smalldatetime
update JPL_FLO_Index_copy
set tempDate = cast(JudgementDate as smalldatetime), JudgementDate = isnull
(judgementDate, '1900-01-01')
alter table JPL_FLO_Index_copy
alter column JudgementDate smalldatetime
update JPL_FLO_Index_copy
set JudgementDate = tempDate
alter table JPL_FLO_Index_copy
drop column tempDate
I'm sure this is fairly simple, but any help/suggestions would be very much appreciated.