Bewerken

Share via


C# .NET and SQL Server supported data types

Applies to: SQL Server 2019 (15.x) and later versions

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