Avatar billede winkill Nybegynder
26. september 2000 - 00:02 Der er 3 kommentarer og
1 løsning

int, varchar etc.

Hej, er der nogen der har en komplet liste over datatyper til MS SQL? Jeg kan ikke få VarChar til at rumme mere end 255 tegn hvilket ikke altid er nok.
Avatar billede privaten Nybegynder
26. september 2000 - 09:02 #1
Data Types (T-SQL)
In Microsoft® SQL Server™, each column, local variable, expression, and parameter has a data type. The set of system-supplied data types is shown below. User-defined data types, which are aliases for system-supplied data types, can also be defined. For more information about user-defined data types, see sp_addtype and Creating User-defined Data Types.

Integers
bit
Integer data with either a 1 or 0 value.
int
Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647).
smallint
Integer data from 2^15 (-32,768) through 2^15 - 1 (32,767).
tinyint
Integer data from 0 through 255.
decimal and numeric
decimal
Fixed precision and scale numeric data from -10^38 -1 through 10^38 -1.
numeric
A synonym for decimal.
money and smallmoney
money
Monetary data values from -2^63 (-922,337,203,685,477.5808) through 2^63 - 1 (+922,337,203,685,477.5807), with accuracy to a ten-thousandth of a monetary unit.
smallmoney
Monetary data values from -214,748.3648 through +214,748.3647, with accuracy to a ten-thousandth of a monetary unit.
Approximate Numerics
float
Floating precision number data from -1.79E + 308 through 1.79E + 308.
real
Floating precision number data from -3.40E + 38 through 3.40E + 38.
datetime and smalldatetime
datetime
Date and time data from January 1, 1753, to December 31, 9999, with an accuracy of three-hundredths of a second, or 3.33 milliseconds.
smalldatetime
Date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minute.
Numerics
cursor
A reference to a cursor.
timestamp
A database-wide unique number.
uniqueidentifier
A globally unique identifier (GUID).
Character Strings
char
Fixed-length non-Unicode character data with a maximum length of 8,000 characters.
varchar
Variable-length non-Unicode data with a maximum of 8,000 characters.
text
Variable-length non-Unicode data with a maximum length of 2^31 - 1 (2,147,483,647) characters.
Unicode Character Strings
nchar
Fixed-length Unicode data with a maximum length of 4,000 characters.
nvarchar
Variable-length Unicode data with a maximum length of 4,000 characters. sysname is a system-supplied user-defined data type that is a synonym for nvarchar(128) and is used to reference database object names.
ntext
Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters.
Binary Strings
binary
Fixed-length binary data with a maximum length of 8,000 bytes.
varbinary
Variable-length binary data with a maximum length of 8,000 bytes.
image
Variable-length binary data with a maximum length of 2^31 - 1 (2,147,483,647) bytes.
Synonyms
Data type synonyms are included for SQL-92 compatibility.

Synonym Mapped to system data type
binary varying varbinary
char varying varchar
character char
character char(1)
character(n) char(n)
character varying(n) varchar(n)
dec decimal
double precision float
float[(n)] for n = 1-7 real
float[(n)] for n = 8-15 float
integer int
national character(n) nchar(n)
national char(n) nchar(n)
national character varying(n) nvarchar(n)
national char varying(n) nvarchar(n)
national text ntext
numeric decimal

Avatar billede privaten Nybegynder
26. september 2000 - 09:06 #2
Prøver lige med en mere læsevenlig version:


bit
Integer data with either a 1 or 0 value.

int
Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647).

smallint
Integer data from 2^15 (-32,768) through 2^15 - 1 (32,767).

tinyint
Integer data from 0 through 255.

decimal
Fixed precision and scale numeric data from -10^38 -1 through 10^38 -1.

numeric
A synonym for decimal.

money
Monetary data values from -2^63 (-922,337,203,685,477.5808) through 2^63 - 1 (+922,337,203,685,477.5807), with accuracy to a ten-thousandth of a monetary unit.

smallmoney
Monetary data values from -214,748.3648 through +214,748.3647, with accuracy to a ten-thousandth of a monetary unit.

float
Floating precision number data from -1.79E + 308 through 1.79E + 308.

real
Floating precision number data from -3.40E + 38 through 3.40E + 38.

datetime
Date and time data from January 1, 1753, to December 31, 9999, with an accuracy of three-hundredths of a second, or 3.33 milliseconds.

smalldatetime
Date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minute.

cursor
A reference to a cursor.

timestamp
A database-wide unique number.

uniqueidentifier
A globally unique identifier (GUID).

char
Fixed-length non-Unicode character data with a maximum length of 8,000 characters.

varchar
Variable-length non-Unicode data with a maximum of 8,000 characters.

text
Variable-length non-Unicode data with a maximum length of 2^31 - 1 (2,147,483,647) characters.

nchar
Fixed-length Unicode data with a maximum length of 4,000 characters.

nvarchar
Variable-length Unicode data with a maximum length of 4,000 characters. sysname is a system-supplied user-defined data type that is a synonym for nvarchar(128) and is used to reference database object names.

ntext
Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters.

binary
Fixed-length binary data with a maximum length of 8,000 bytes.

varbinary
Variable-length binary data with a maximum length of 8,000 bytes.

image
Variable-length binary data with a maximum length of 2^31 - 1 (2,147,483,647) bytes.

Avatar billede winkill Nybegynder
26. september 2000 - 10:52 #3
Tak
Avatar billede privaten Nybegynder
26. september 2000 - 11:12 #4
Anytime
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Computerworld tilbyder specialiserede kurser i database-management

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester