.NET 10 is here — faster, smarter, and more powerful. What are you waiting for? Upgrade your skills today with us!
← Back to Blogs
SQLNov 09, 2025
SQL Data Types

Mastering the Connection: A Complete Guide to Mapping SQL Server and C# Data Types

👤 Rohan Kumawat⏱️ 6 min read

Let's dive into the definitive mapping table, highlighting the best practices for handling everything from simple integers to complex time stamps and binary data.

SQL Server to C# Data Type Mapping

SQL Server Data Type C# Data Type Notes
intint32-bit signed integer (System.Int32)
smallintshort16-bit signed integer (System.Int16)
tinyintbyte8-bit unsigned integer (System.Byte)
bigintlong64-bit signed integer (System.Int64)
bitboolBoolean (true / false)
decimal(p,s) / numeric(p,s)decimalHigh precision (often used for money, currency, etc.)
money, smallmoneydecimalMonetary data type
floatdouble64-bit floating-point (System.Double)
realfloat32-bit floating-point (System.Single)
char, nchar, varchar, nvarchar, text, ntextstringAll variable and fixed-length character types map to C# string
date, datetime, smalldatetime, datetime2DateTimeDate and time without timezone info
datetimeoffsetDateTimeOffsetIncludes timezone offset information
timeTimeSpanRepresents a time of day or time interval
uniqueidentifierGuidGlobally Unique Identifier
binary, varbinary, imagebyte[]For file storage or any binary data