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 |
|
Antinsh
Starting Member
16 Posts |
Posted - 2008-03-16 : 02:58:04
|
| HiSince SQL image type is getting old and all (at least so I hear... or read) i figured that i need to update my database. So i create a software that does that.... gets image row IDs,creates varbinary(max) table, copies image data to varbinary table with query like:"UPDATE Atbildes_variants SET [binVarianta_teksts_RTF] = [Varianta_teksts_RTF] WHERE ID=6500"So everyting kinda worked out fine (Oh and to those of you wondering why i didnt just use Management Studio and change datatypes - well I guess some of my tables contained too much data and it kept on broking down)But in some fields where the old value was NULL after updates there is something that looks like "0x". It's not null - it's like an epmpty string or something.Question: Does anyone knows why this happens? Can I change my update Query to avoid that? Only option I have figured out so far is to after all that just change all "0x"s to NULLs. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-16 : 04:26:35
|
Did you use CAST or CONVERT?Do the new columns allow NULLs?UPDATE Atbildes_variantsSET [binVarianta_teksts_RTF] = CASE WHEN [Varianta_teksts_RTF] IS NULL THEN NULL ELSE CAST([Varianta_teksts_RTF] AS VARBINARY(MAX))WHERE ID=6500 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Antinsh
Starting Member
16 Posts |
Posted - 2008-03-16 : 04:36:00
|
| no i neither cast or convert :) I just kinda did:"UPDATE Atbildes_variants SET [binVarianta_teksts_RTF] = [Varianta_teksts_RTF] WHERE ID=6500"and it worked... for the most part as i already told. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-16 : 14:12:25
|
Did you try to update with the CASE statement above? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|