C# odpowiednik danych SQL Server

Dla następujących typów danych SQL Server, jaki byłby odpowiedni typ danych w C#?

Dokładne Liczby

bigint
numeric
bit
smallint
decimal
smallmoney
int
tinyint
money

Przybliżone Liczby

float
real

Data i godzina

date
datetimeoffset
datetime2
smalldatetime
datetime
time

Ciągi Znaków

char
varchar
text

Ciągi Znaków Unicode

nchar
nvarchar
ntext

Ciągi Binarne

binary
varbinary
image

Inne Typy Danych

cursor
timestamp
hierarchyid
uniqueidentifier
sql_variant
xml
table

(źródło: MSDN )

Author: George Stocker, 2009-01-08

2 answers

To jest dla SQL Server 2005 . Istnieją zaktualizowane wersje tabeli dla SQL Server 2008, SQL Server 2008 R2, SQL Server 2012 i SQL Server 2014.

Typy danych SQL Server i ich odpowiedniki. NET Framework

Poniższa tabela zawiera listę typów danych Microsoft SQL Server, ich odpowiedników w common language runtime (CLR) dla SQL Server w systemie .Data.Sqltypes przestrzeń nazw i ich natywny CLR odpowiedniki w Microsoft. NET Framework.

SQL Server data type          CLR data type (SQL Server)    CLR data type (.NET Framework)  
varbinary                     SqlBytes, SqlBinary           Byte[]  
binary                        SqlBytes, SqlBinary           Byte[]  
varbinary(1), binary(1)       SqlBytes, SqlBinary           byte, Byte[] 
image                         None                          None

varchar                       None                          None
char                          None                          None
nvarchar(1), nchar(1)         SqlChars, SqlString           Char, String, Char[]     
nvarchar                      SqlChars, SqlString           String, Char[] 
nchar                         SqlChars, SqlString           String, Char[] 
text                          None                          None
ntext                         None                          None

uniqueidentifier              SqlGuid                       Guid 
rowversion                    None                          Byte[]  
bit                           SqlBoolean                    Boolean 
tinyint                       SqlByte                       Byte 
smallint                      SqlInt16                      Int16  
int                           SqlInt32                      Int32  
bigint                        SqlInt64                      Int64 

smallmoney                    SqlMoney                      Decimal  
money                         SqlMoney                      Decimal  
numeric                       SqlDecimal                    Decimal  
decimal                       SqlDecimal                    Decimal  
real                          SqlSingle                     Single  
float                         SqlDouble                     Double  

smalldatetime                 SqlDateTime                   DateTime  
datetime                      SqlDateTime                   DateTime 

sql_variant                   None                          Object  
User-defined type(UDT)        None                          user-defined type     
table                         None                          None 
cursor                        None                          None
timestamp                     None                          None 
xml                           SqlXml                        None
 848
Author: Örjan Jämte,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-06-05 17:37:11

SQL Server i. NET Framework są oparte na systemach różnych typów. Na przykład struktura dziesiętna. NET Framework ma maksymalną skalę 28, podczas gdy typy danych dziesiętnych i liczbowych SQL Server mają maksymalną skalę 38. Kliknij tutaj A link ! dla szczegółów

Https://msdn.microsoft.com/en-us/library/cc716729 (v=vs.110). aspx

 5
Author: Salman,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-03-15 07:54:06