0% found this document useful (0 votes)
179 views3 pages

C# Equivalencia de Tipos de Datos de SQL Server y

This document lists the mapping between SQL Server data types and equivalent .NET Framework data types in C#. It shows that most SQL Server types have direct equivalents in the System.Data.SqlTypes namespace or can be represented by common .NET types like String, Int32, DateTime. Some SQL Server types like geometry and hierarchyid have custom classes defined in the Microsoft.SqlServer.Types.dll assembly.

Uploaded by

Victor Galarza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views3 pages

C# Equivalencia de Tipos de Datos de SQL Server y

This document lists the mapping between SQL Server data types and equivalent .NET Framework data types in C#. It shows that most SQL Server types have direct equivalents in the System.Data.SqlTypes namespace or can be represented by common .NET types like String, Int32, DateTime. Some SQL Server types like geometry and hierarchyid have custom classes defined in the Microsoft.SqlServer.Types.dll assembly.

Uploaded by

Victor Galarza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

C# Equivalencia de datos de SQL Server y .

NET

Mapping CLR Parameter Data

SQL Server 2014

The following table lists Microsoft SQL Server data types, their equivalents in the common language runtime (CLR)
for SQL Server in the System.Data.SqlTypes namespace, and their native CLR equivalents in the Microsoft .NET
Framework.

Type (in System.Data.SqlTypes or


SQL Server data type CLR data type (.NET Framework)
Microsoft.SqlServer.Types)

bigint SqlInt64 Int64, Nullable<Int64>

binary SqlBytes, SqlBinary Byte[]

bit SqlBoolean Boolean, Nullable<Boolean>

char None None

cursor None None

date SqlDateTime DateTime, Nullable<DateTime>

datetime SqlDateTime DateTime, Nullable<DateTime>

datetime2 None DateTime, Nullable<DateTime>

DateTimeOffset,
DATETIMEOFFSET None
Nullable<DateTimeOffset>

decimal SqlDecimal Decimal, Nullable<Decimal>

float SqlDouble Double, Nullable<Double>

SqlGeography

SqlGeography is defined in
geography None
Microsoft.SqlServer.Types.dll, which is installed with
SQL Server and can be downloaded from the SQL
Server 2014 feature pack.

SqlGeometry

SqlGeometry is defined in
geometry None
Microsoft.SqlServer.Types.dll, which is installed with
SQL Server and can be downloaded from the SQL
Server 2014 feature pack.

hierarchyid SqlHierarchyId None

SqlHierarchyId is defined in
Microsoft.SqlServer.Types.dll, which is installed with
SQL Server and can be downloaded from the SQL
Server 2014 feature pack.

image None None

int SqlInt32 Int32, Nullable<Int32>

money SqlMoney Decimal, Nullable<Decimal>

nchar SqlChars, SqlString String, Char[]

ntext None None

numeric SqlDecimal Decimal, Nullable<Decimal>

SqlChars, SqlString

nvarchar SQLChars is a better match for data transfer and String, Char[]
access, and SQLString is a better match for
performing String operations.

nvarchar(1), nchar(1) SqlChars, SqlString Char, String, Char[], Nullable<char>

SqlSingle (the range of SqlSingle, however, is larger


real Single, Nullable<Single>
than real)

rowversion None Byte[]

smallint SqlInt16 Int16, Nullable<Int16>

smallmoney SqlMoney Decimal, Nullable<Decimal>

sql_variant None Object

table None None

text None None

time None TimeSpan, Nullable<TimeSpan>

timestamp None None

tinyint SqlByte Byte, Nullable<Byte>

uniqueidentifier SqlGuid Guid, Nullable<Guid>

The same class that is bound to the user-


User-defined
None defined type in the same assembly or a
type(UDT)
dependent assembly.

varbinary SqlBytes, SqlBinary Byte[]


varbinary(1), binary(1) SqlBytes, SqlBinary byte, Byte[], Nullable<byte>

varchar None None

xml SqlXml None

You might also like