"Mitchell Vincent" <[EMAIL PROTECTED]> writes:

> I have an old SQLite 2.8 database that shared it's schema with
> PostgreSQL. One of the nifty things about PostgreSQL (that admittedly
> has me spoiled) is the ability to just say "varchar" without any
> length specifier.
>
> Specifying "varchar" in SQLite works great - no problem at all. Until
> I tried to use it with ODBC. The SQLite ODBC driver works fine but
> assumes a 255 character limit. As soon as it returns a result longer
> than 255 it blows an error.
>
> I see in the SQLite ODBC driver's documentation that it does support >
> 255 varchar fields but I _assume_ have to specify that it's > 255 in
> the schema.
>
> Now comes the fun part. I'm converting these databases (and there are
> a LOT of them), I'm doing "sqlite OLD.DB .dump | sqlite3 NEW.DB" which
> works flawlessly. Is there any way to change the schema on the fly to
> say "Varchar(1024)" instead of just "varchar" (or just use an SQLite
> 'type' of "text") ?

If you don't have the word varchar anyplace else, e.g. in your data, you can
simply do:

  sqlite OLD.DB .dump | sed 's/varchar/text/' | sqlite3 NEW.DB

If the word varchar may exist elsewhere, or be in various cases (VARCHAR,
Varchar, etc.), you'll have to be a bit more creative.  "awk" may be your
friend.

Derrell

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to