convert

Ivan Smahin ivan_smahin at paradigmasoft.com
Fri Mar 28 08:31:07 CDT 2008


Hello Danny,

Friday, March 28, 2008, 2:57:13 PM, you wrote:

> Hi List,

> anyone knows if CONVERT works in valentina?
> I have a field 'levelname' and want to order on that, problem is, that
> this is a varchar field and when i have records lke this :

> 1,2,3,4,5,6,7,8,9,10,11,12,...

> it sorts like : 1,10,11,12,13,...2,20,21,22,....

> which is normal because its an varchar field.

> So I tried to convert this varchar field to an integer using :

> SELECT CONVERT(INTEGER, LEVELNAME) AS INTLEVEL FROM TBL_SCORELEVELS

> but i keep getting error :

> 13:47:54: Error: Kernel error: 0x71000. line 1:15: unexpected token:  
> CONVERT

CREATE TABLE t1 ( f1 Varchar(20) );
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
select * from t2 order by f1;
--
1
10
2

ALTER TABLE t1 MODIFY f2 LONG;

select * from t2 order by f1;
--
1
2
10


-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list