Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
omega1983
Starting Member
40 Posts |
Posted - 2009-12-11 : 12:33:40
|
| I have a datetime field as follows:birthdate (datetime,null)sample: 1947-01-10 00:00:00.000I have three separate text fields that can be brought together to make up a text version of a datebirthmonth char(2) birthday char(2) birthyear char(4)sample: '1947','01','10'I want to populate the birthdate (datetime,null)with the three text fields where the birthdate (datetime,null) is null. I tried this:select birthmonth,birthday,birthyear from birthday_tableupdate birthday_tableset birthdate = birthyear+'-'+birthmonth+'-'+birthday+'00:'++'00:'++'00:'++'0000'where birthdate = '' or birthdate is null and got the error messageConversion failed when converting datetime from character string. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-12-11 : 12:36:07
|
i think this is enoughupdate birthday_tableset birthdate = birthyear+'-'+birthmonth+'-'+birthdaywhere birthdate = '' or birthdate is null also are birthmonth etc nullable fields? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-12-12 : 01:39:54
|
| orupdate birthday_tableset birthdate = birthyear+birthmonth+birthdaywhere birthdate = '' or birthdate is null MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|