Data type mapping tables

This section provides the mapping rules from the original data type to the C# data type, or the data type returned by PowerServer on executing SyntaxFromSQL. If the C# data type or the type returned by PowerServer is different from what's listed in the tables, you would need to make necessary changes to the C# models or the SQL syntax, to avoid possible errors.

SQL server data type mappings

Data type in SQL Server

Data type in C# models

Data type returned by PowerServer on SyntaxFromSQL

bigint

long

decimal

binary

blob

blob

bit

bool

number

char

string

char

date

datetime

date

datetime

datetime

datetime

datetime2(7)

datetime

datetime

datetimeoffset(7)

DateTimeOffset

char

decimal(18, 2)

decimal

decimal

float

double

number

geography

blob

blob

geometry

blob

blob

hierarchyid

blob

blob

image

 

Blob

int

int

long

money

decimal

decimal

nchar

string

char

ntext

string

char

numeric(18, 2)

decimal

decimal

nvarchar

string

char

real

Single

real

smalldatetime

DateTime

datetime

smallint

short

long

smallmoney

decimal

decimal

sql_variant

object

char

text

string

char(32766)

time(7)

TimeSpan

time

timestamp

byte[]

timestamp

tinyint

byte

long

uniqueidentifier

Guid

char

varbinary

blob

blob

varchar

string

char

xml

string

char(32766)

ASE server data type mappings

Data type in ASE

Data type in C# models

Data type returned by PowerServer on SyntaxFromSQL

bigdatetime

DateTime

 

bigint

decimal

Decimal(0)

bigtime

DateTime

datetime

binary

byte[]

char

bit

bool

number(1)

char

string

char

date

DateTime

date

datetime

DateTime

datetime

decimal

decimal

decimal

float

double

number

image

 

blob

int

int

long

longsysname

string

char

money

decimal

decimal

nchar

string

char

numberic

decimal

decimal

nvarchar

string

char

real

float

real

smalldatetime

DateTime

datetime

smallint

short

long

smallmoney

decimal

decimal

sysname

string

char

text

string(32000)

char

time

TimeSpan

time

timestamp

byte[]

timestamp

tinyint

byte

long

unichar

string

char

unitext

string

char

univarchar

string

char

unsigned bigint

decimal

decimal

usigned int

long

ulong

unsigned smallint

int

ulong

varbinary

byte

char

varchar

string

char

SQL Anywhere server data type mappings

Data type in SQL Anywhere

Data type in C# models

Data type returned by PowerServer on SyntaxFromSQL

bigint

long

decimal(0)

binary

 

blob

bit

bool

number

char

string

char

date

datetime

date

datetime

datetime

datetime

datetimeoffset

string

char

decimal(18,2)

decimal

decimal(2)

double

double

number

float

single

real

image

 

blob

integer

int

long

long binary

 

blob

long nvarchar

string

char

long varbit

string

char

long varchar

string

char

money

decimal

decimal

nchar

string

char

ntext

string

char

numeric(18,2)

decimal

decimal(2)

nvarchar

string

char

real

single

real

smalldatetime

datetime

datetime

smallint

short

long

smallmoney

decimal

decimal

text

string

char

time

timespan

time

timestamp

datetime

datetime

timestamp with time zone

string

char

tinyint

byte

long

uniqueidentifier

guid

char

uniqueidentifierstr

string

char

unsignedbigint

decimal

decimal

unsignedint

long

UnsingedLong

unsignedsmallint

int

UnsingedLong

varbinary(50)

 

blob

varbit(50)

string

char

varchar(50)

string

char

xml

string

char

sysname

string

char

Oracle server data type mappings

Data type in Oracle

Data type in C# models

Data type returned by PowerServer on SyntaxFromSQL

BINARY_DOUBLE

double

BinaryDouble

BINARY_FLOAT

single

BinaryFloat

BLOB

 

Blob

CLOB

string

Char

CHAR

string

Char

DATE

datetime

Datetime

INTERVAL DAY(2) TO SECOND(6)

   

INTERVAL YEAR(2) TO MONTH

   

LONG

string

Char

NCLOB

string

Char

     

NVARCHAR2

string

Char

RAW

 

Blob

TIMESTAMP(6)

datetime

Datetime

TIMESTAMP(6) WITH LOCAL TIME ZONE

datetime

Datetime

TIMESTAMP(6) WITH TIME ZONE

datetime

Datetime

VARCHAR2

string

char

NUMBER(2)

short

int16

number

 

Decimal

NUMBER(5,2)

single

Single

number(10)

 

Int64

number(10,2)

 

double

number(7)

 

int32

number(15)

 

int64

PostgreSQL data type mappings

Data type in PostgreSQL

Data type in C# models

Data type returned by PowerServer on SyntaxFromSQL

bigint

long

decimal(0)

bigserial

long

decimal(0)

bit

bool

char

bit varying

 

char

boolean

 

char

Box

 

char

bytea

 

blob

character

string

char

character varying

string

char

cid

Uint32

char

cidr

 

char

circle

 

char

date

datetime

date

daterange

 

char

double precision

double

number

gtsvector

 

char

inet

ipaddress

char

int2vector

 

char

int4range

 

char

integer

int

long

interval

 

char

json

string

char

line

 

char

macaddr

physicaladdress

char

money

decimal

number

name

 

char

numeric(10,1)

decimal

decimal(1)

numrange

 

char

oid

 

char

path

 

char

point

 

char

polygon

 

char

real

float

real

refcursor

 

char

serial

int

long

regdictionary

 

char

smallint

short

long

smallserial

short

long

Text

string

char

tid

 

char

time with time zone(6)

datetimeoffset

char

time without time zone(6)

timespan

time

timestamp with time zone(6)

datespan

datetime

timestamp without time zone(6)

datespan

timestamp

tsquery

 

char

tsrange

 

char

uuid

guid

char

xid

 

char

xml

string

char