miércoles, 4 de enero de 2012

Equivalencias entre Tipos de Datos SQL SERVER 2008 y C#

SQL Server data type

CLR data type (SQL Server)

CLR data type (.NET Framework)

bigint

SqlInt64

Int64, Nullable

binary

SqlBytes, SqlBinary

Byte[]

bit

SqlBoolean

Boolean, Nullable

char

None

None

cursor

None

None

date

SqlDateTime

DateTime, Nullable

datetime

SqlDateTime

DateTime, Nullable

datetime2

SqlDateTime

DateTime, Nullable

DATETIMEOFFSET

None

DateTimeOffset, Nullable

decimal

SqlDecimal

Decimal, Nullable

float

SqlDouble

Double, Nullable

image

None

None

int

SqlInt32

Int32, Nullable

money

SqlMoney

Decimal, Nullable

nchar

SqlChars, SqlString

String, Char[]

ntext

None

None

numeric

SqlDecimal

Decimal, Nullable

nvarchar

SqlChars, SqlString

SQLChars is a better match for data transfer and access, andSQLString is a better match for performing String operations.

String, Char[]

nvarchar(1), nchar(1)

SqlChars, SqlString

Char, String, Char[], Nullable

real

SqlSingle

Single, Nullable

rowversion

None

Byte[]

smallint

SqlInt16

Int16, Nullable

smallmoney

SqlMoney

Decimal, Nullable

sql_variant

None

Object

table

None

None

text

None

None

time

TimeSpan

TimeSpan, Nullable

timestamp

None

None

tinyint

SqlByte

Byte, Nullable

uniqueidentifier

SqlGuid

Guid, Nullable

User-defined type(UDT)

None

The same class that is bound to the user-defined type in the same assembly or a dependent assembly.

varbinary

SqlBytes, SqlBinary

Byte[]

varbinary(1), binary(1)

SqlBytes, SqlBinary

byte, Byte[], Nullable

varchar

None

None

xml

SqlXml

None

No hay comentarios: