| Author |
Topic |
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-07-18 : 05:59:05
|
| I know how to update numeric and text fields in my database, but have no idea on how to 'blank off' a date field. I try this and it doesnt like itupdate wce_contactset mail1date = ''where website in ('www.name1.co.uk','www.name2.co.uk','www.name3.co.uk')any ideas? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-18 : 06:06:28
|
| if its a nullable field, set it to null |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-07-18 : 06:13:19
|
| its not nullable or at least i dont think so. how would i check that? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-18 : 06:29:10
|
quote: Originally posted by Topaz its not nullable or at least i dont think so. how would i check that?
SELECT IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME=yourcolumnname if 1 then its nullable. |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-07-18 : 06:33:27
|
| I had to use:SELECT IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'mail1date'and the results say 40 rows with column IS_NULLABLE all with 'YES' written in them. not sure what that means... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-18 : 06:44:47
|
quote: Originally posted by Topaz I had to use:SELECT IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'mail1date'and the results say 40 rows with column IS_NULLABLE all with 'YES' written in them. not sure what that means...
that menas you have 40 columns with this name in various tables and all of them are of nullable type.see value of TABLE_NAME to determine the tablesSELECT TABLE_NAMEIS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'mail1date' |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-07-18 : 07:08:01
|
| ok just tried nulling the date filed and got this:Msg 241, Level 16, State 1, Line 1Conversion failed when converting datetime from character string. |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-07-18 : 07:45:44
|
| show us the syntax you used to try and null it?Em |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-07-18 : 07:55:57
|
| update wce_contactset mail1date = 'null'where expressemail in ('example@example.com') |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-07-18 : 08:00:46
|
| = NULLEm |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-18 : 08:07:01
|
quote: Originally posted by Topaz update wce_contactset mail1date = 'null'where expressemail in ('example@example.com')
'NULL' and NULL are not same 'NULL' means string value NULL while NULL means unknown value. so use NULL as suggested by elancaster. |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-07-18 : 09:17:34
|
| thanking you |
 |
|
|
|