Skip to content

Latest commit

 

History

History
52 lines (46 loc) · 1.92 KB

c-sharp-to-sql-data-types.md

File metadata and controls

52 lines (46 loc) · 1.92 KB
title titleSuffix description author ms.author ms.date ms.service ms.subservice ms.topic monikerRange
C# data types
SQL Server Language Extensions
Map data types from C# .NET to SQL Server for input and output data structures, and for input parameters on the sp_execute_external_script.
rwestMSFT
randolphwest
04/29/2024
sql
language-extensions
conceptual
>=sql-server-ver15 || >=sql-server-linux-ver15

C# .NET and SQL Server supported data types

[!INCLUDE sqlserver2019-and-later]

This article maps SQL Server data types to .NET data types (used by C#) for data structures and parameters on sp_execute_external_script.

The following SQL and .NET data types are currently supported for input/output data sets and input/output parameters.

SQL Server data type .NET data type Comment
bit bool
tinyint byte
smallint short
int int
real float
bigint long
float double
nchar(n) string
nvarchar(n) string
binary(n) byte[]
varbinary(n) byte[]
nvarchar(max) string
varbinary(max) byte[]
uniqueidentifier Guid
char(n) string
varchar(n) string
varchar(max) string
date DateOnly .NET 6 and later versions
time TimeOnly .NET 6 and later versions
numeric decimal
decimal decimal
money decimal
smallmoney decimal
smalldatetime DateTime
datetime DateTime
datetime2 DateTime

Related content