• Login

DataSoft Corporation

CAST (exp AS type)

Examples

The following example casts a DATE to a CHAR.

SELECT CAST(cdate as CHAR20) FROM u1

If the current date were January 1, 2004, the SELECT returns 2004-01-01.


Pervasive PSQL Data Types and Equivalent ODBC Data Types  

Transactional Type (Size)

Relational Type

ODBC Type (code)1

Type Code2

Size (bytes)

Create/Add Parameters4

Notes

AUTOINC(2)

SMALLIDENTITY

SQL_SMALLINT(5)

15

2

   

AUTOINC(4)

IDENTITY

SQL_INTEGER(4)

15

4

   

BFLOAT(4)

BFLOAT4

SQL_REAL(7)

9

4

not null

4

BFLOAT(8)

BFLOAT8

SQL_DOUBLE(8)

9

8

not null

4

BLOB

LONGVARBINARY

SQL_LONGVARBINARY(-4)

21

n/a3

not null

2, 3, 6

CLOB

LONGVARCHAR

SQL_LONGVARCHAR(-1)

21

n/a3

not null
case insensitive

5, 6

CURRENCY

CURRENCY

SQL_DECIMAL(3)

19

8

not null

 

DATE

DATE

SQL_DATE(9)

3

4

not null

 

none

DATETIME

SQL_TIMESTAMP(11)

30

8

not null

10

DECIMAL

DECIMAL

SQL_DECIMAL(3)

5

1 - 64

precision
scale
not null

 

FLOAT(4)

REAL

SQL_REAL(7)

2

4

not null

 

FLOAT(8)

DOUBLE

SQL_DOUBLE(8)

2

8

not null

 

GUID

UNIQUEIDENTIFIER

SQL_GUID(-11)

27

16

not null

 

INTEGER(1)

TINYINT

SQL_TINYINT(-6)

1

1

not null

 

INTEGER(2)

SMALLINT

SQL_SMALLINT(5)

1

2

not null

 

INTEGER(4)

INTEGER

SQL_INTEGER(4)

1

4

not null

 

INTEGER(8)

BIGINT

SQL_DECIMAL(3)

1

8

not null

 

MONEY

DECIMAL

SQL_DECIMAL(3)

6

1 - 64

precision
scale
not null

 

NUMERIC

NUMERIC

SQL_NUMERIC(2)

8

1 - 37

precision
scale
not null

4

NUMERICSA

NUMERICSA

SQL_NUMERIC(2)

18

1 - 37

precision
scale
not null

4

NUMERICSLB

NUMERICSLB

SQL_NUMERIC(2)

28

1 - 37

precision
scale
not null

4

NUMERICSLS

NUMERICSLS

SQL_NUMERIC(2)

29

1 - 37

precision
scale
not null

4

NUMERICSTB

NUMERICSTB

SQL_NUMERIC(2)

31

1 - 37

precision
scale
not null

4

NUMERICSTS

NUMERICSTS

SQL_NUMERIC(2)

17

1 - 37

precision
scale
not null

4

STRING

BINARY

SQL_BINARY(-2)

0

1- 8,000

size
not null
case insensitive

2, 3

STRING

CHAR

SQL_CHAR(1)

0

1- 8,000

size
not null
case insensitive

1

TIME

TIME

SQL_TIME(10)

4

4

not null

 

TIMESTAMP

TIMESTAMP

SQL_TIMESTAMP(11)

20

8

not null

 

UNSIGNED(1) BINARY

UTINYINT

SQL_TINYINT(-6)

14

1

not null

 

UNSIGNED(2) BINARY

USMALLINT

SQL_SMALLINT(5)

14

2

not null

 

UNSIGNED(4) BINARY

UINTEGER

SQL_INTEGER(4)

14

4

not null

 

UNSIGNED(8) BINARY

UBIGINT

SQL_DECIMAL(3)

14

8

not null

 

WSTRING

not supported in SQL

not supported in SQL

25

n/a3

 

7

WZSTRING

not supported in SQL

not supported in SQL

26

n/a3

 

7

ZSTRING

VARCHAR

SQL_VARCHAR(12)

11

1- 8,000

size
not null
case insensitive

5

none

BIT

SQL_BIT(-7)

16

1 bit

 

6, 8

LOGICAL(1)

BIT

SQL_BIT(-7)

7

1 bit

 

9

LOGICAL(2)

SMALLINT

SQL_SMALLINT(5)

1

2

not null

 
Thursday, 18 April 2019 Posted in Conversion Functions
 DataSoft Store  Knowledgebase  Contact Us
 Sitemap  Privacy Policy
    Customer Service


Copyright © 2019 DataSoft Corporation All rights reserved.