Subject | Re: Conversion error from string run time error 2147467259 |
---|---|
Author | Adam |
Post date | 2006-07-20T06:13Z |
--- In firebird-support@yahoogroups.com, Adriano <fadrianoc@...>
wrote:
1. You need to create a new varchar field that is big enough
2. Copy the data across
3. Drop the blob field
4. Create a new varchar field
5. Copy the data back
The only trick is that to cast a BLOB to a varchar, you need to use
the SUBSTRING function.
eg.
alter table A add tmp varchar(100);
commit;
update A set tmp = substring(SomeField from 1 for 100);
commit;
alter table A drop SomeField;
commit;
alter table A add SomeField varchar(100);
commit;
update A set SomeField = tmp;
commit;
---
Note that your varchar field will need to be large enough to entirely
store the largest BLOB.
Adam
wrote:
>possible to
> An alternative test could be changing blob into long varchar,
> but i've tried to do with sql manager without result, is it
> convert existing blob field (they has only few char in it actuallyin
> database) into varchar field ?Indirectly yes.
1. You need to create a new varchar field that is big enough
2. Copy the data across
3. Drop the blob field
4. Create a new varchar field
5. Copy the data back
The only trick is that to cast a BLOB to a varchar, you need to use
the SUBSTRING function.
eg.
alter table A add tmp varchar(100);
commit;
update A set tmp = substring(SomeField from 1 for 100);
commit;
alter table A drop SomeField;
commit;
alter table A add SomeField varchar(100);
commit;
update A set SomeField = tmp;
commit;
---
Note that your varchar field will need to be large enough to entirely
store the largest BLOB.
Adam