Ben Atkinson <bwa4...@yahoo.com> wrote:
> Sorry for the newbie SQL question.  I'm trying to use the INSERT INTO
> statement with a hexadecimal literal.  I want to accomplish something
> like this:
>
> INSERT INTO TruckDefaultsTable VALUES ( 'AirPressureTime', 0,
> 0xB40000);
>
> Does SQL have a hex literal sequence that serves the same role as
> "0x" in C?

No, there's no syntax for integral hexadecimal literals. There is a blob 
literal x'B40000', but it doesn't behave like a number (e.g. you can't 
do arithmetic on blobs). Bottom line, the only option is to use plain 
vanilla decimal numbers.

> I could express the value in decimal as 11796480, but that's pretty
> awkward since the actual value I'm putting into the table is a Linux
> timeval structure. It just makes more sense as hex.

How come you need to type these timestamps in by hand? When you work 
with SQLite programmatically, you just use int variables and such - 
there's almost never a need to represent the number as string, whether 
decimal or hex.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to