How about something like:

WITH RECURSIVE
expansion(byte) AS (
    SELECT 0
    UNION  ALL
    SELECT byte + 1 FROM expansion
    LIMIT  10
)
SELECT PRINTF('%02d',byte)
FROM   expansion
;

Cheers,
Dave


Ward Analytics Ltd - information in motion
Tel: +44 (0) 118 9740191
Fax: +44 (0) 118 9740192
www: http://www.ward-analytics.com

Registered office address: The Oriel, Sydenham Road, Guildford, Surrey, United 
Kingdom, GU1 3SR
Registered company number: 3917021 Registered in England and Wales.

-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Cecil 
Westerhof
Sent: 21 April 2016 11:20
To: SQLite mailing list
Subject: [sqlite] SELECT 0 gives TEXT instead of INTEGER

I have the following:
WITH RECURSIVE
expansion(byte) AS (
    SELECT 0
    UNION  ALL
    SELECT byte + 1 FROM expansion
    LIMIT  10
)
SELECT hex(byte)
FROM   expansion
;

?I would expect to get 00-09, but I get 30-39. 30 is the hex-value of the ASCII 
0. How would I get what I want. I could subtract 48, but that is not my 
preferred solution.?

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to