Avatar billede funstuff.dk Nybegynder
04. oktober 2001 - 18:56 Der er 11 kommentarer og
1 løsning

Data Type ??

Hej..

Jeg er lige begundt at bruge MS SQL i stedet for Access til mine asp sider..

Men har lidt problemer med hvad de forskellige data typer betyper og bruges til..

SÅ er der nogle der kan lave en lille forklaring på hvad de forskellige betyder og bruges til...??

Og hvad hedder den som hedder Notat i access??

Op forhånd tak..

Mvh
Morten Terp
Avatar billede terry Ekspert
04. oktober 2001 - 20:10 #1
You can see a full list in the Books Online.
Search for Data Types. There are many more than in Access so it would take ages to explain them all.

Avatar billede terry Ekspert
04. oktober 2001 - 20:14 #2
the memo field I think would be a text or Ntext and image

the n in ntext means that it can store unicode characters
Avatar billede terry Ekspert
04. oktober 2001 - 20:15 #3
just out of interest a text field can store 2^31 byes of data
Avatar billede pierrehusted Nybegynder
05. oktober 2001 - 10:30 #4
Du skal bare lige være opmærksom på at TEXT og NTEXT opfører sig lidt underligt. De vil helst ligge sidst i tabellen, eller i hvert fald hentes sidst.
Og hvis du har et TEXT felt i et recordset, så kan du nogle gange kun læse feltet fra recordsettet EEN gang (d.v.s. du er nødt til at lægge det over i en variabel for at bruge det flere gange).
Avatar billede terry Ekspert
10. oktober 2001 - 20:49 #5
funstuff.dk are you going to answer this question?
Avatar billede funstuff.dk Nybegynder
10. oktober 2001 - 20:55 #6
Jo, men har nu ik helt fået svar på hvad alle de forskellige kan...
Avatar billede terry Ekspert
10. oktober 2001 - 20:58 #7
Data Types
To use the Open Data Services data types, include the Srv.h header file in your program. Open Data Services applications also use the same data type definitions as DB-Library functions.


Data type SQL Server
data type
Description
SRVBIGBINARY binary binary data type, length 0 to 8000 bytes.
SRVBIGCHAR char character data type, length 0 to 8000 bytes.
SRVBIGVARBINARY varbinary Variable-length binary data type, length 0 to 8000 bytes.
SRVBIGVARCHAR varchar Variable-length character data type, length 0 to 8000 bytes.
SRVBINARY binary binary data type.
SRVBIT bit bit data type.
SRVBITN bit null  bit data type, null values allowed.
SRVCHAR char character data type.
SRVDATETIME datetime 8-byte datetime data type.
SRVDATETIM4 smalldatetime 4-byte smalldatetime data type.
SRVDATETIMN datetime null smalldatetime or datetime data type, null values allowed.
SRVDECIMAL decimal decimal data type.
SRVDECIMALN decimal null decimal data type, null values allowed.
SRVFLT4 real 4-byte real data type.
SRVFLT8 float 8-byte float data type.
SRVFLTN real | float null real or float data type, null values allowed.
SRVIMAGE image image data type.
SRVINT1 tinyint 1-byte tinyint data type.
SRVINT2 smallint 2-byte smallint data type.
SRVINT4 int 4-byte int data type.
SRVINTN tinyint | smallint | int null tinyint, smallint, or int data type, null values allowed.
SRVMONEY4 smallmoney 4-byte smallmoney data type.
SRVMONEY money 8-byte money data type.
SRVMONEYN money | smallmoney null smallmoney or money data type, null values allowed.
SRVNCHAR nchar Unicode character data type.
SRVNTEXT ntext Unicode text data type.
SRVNUMERIC numeric numeric data type.
SRVNUMERICN numeric null numeric data type, null values allowed.
SRVNVARCHAR nvarchar Unicode variable-length character data type.
SRVTEXT text text data type.
SRVVARBINARY varbinary Variable-length binary data type.
SRVVARCHAR varchar Variable-length character data type.


Open Data Services Data Type Conversions
The following chart shows conversions allowed for Open Data Services data types. It does not include the following data types for which conversions are not supported: SRVGUID, SRVNTEXT, SRVBIGVARBINARY, SRVBIGVARCHAR, SRVBIGBINARY, SRVBIGCHAR, and SRVNCHAR.





(c) 1988-98 Microsoft Corporation. All Rights Reserved.


Data Type Usage
The Microsoft® SQL Server™ ODBC driver and SQL Server impose the following use of data types.

Data type Limitation
Date literals Date literals, when stored in a SQL_TYPE_TIMESTAMP column (SQL Server data types of datetime or smalldatetime), have a time value of 12:00:00.000 A.M. (midnight).
money and smallmoney Only the integer parts of the money and smallmoney data types are significant. If the decimal part of SQL money data is truncated during data type conversion, the SQL Server ODBC driver returns a warning, not an error.
SQL_BINARY (nullable) When connected to SQL Server version 6.0 and earlier, if a SQL_BINARY column is nullable, the data that is stored in the data source is not padded with zeroes. When data from such a column is retrieved, the SQL Server ODBC driver pads it with zeroes on the right. However, data that is created in operations performed by SQL Server, such as concatenation, does not have such padding.
Also, when data is placed in such a column in SQL Server 6.0 or earlier, SQL Server truncates the data on the right if it is too long to fit into the column.

SQL_CHAR (truncation) When connected to SQL Server 6.0 and earlier, and data is placed into a SQL_CHAR column, SQL Server truncates it on the right without warning if the data is too long to fit into the column.
SQL_CHAR (nullable) When connected to SQL Server 6.0 and earlier, if a SQL_CHAR column is nullable, the data that is stored in the data source is not padded with blanks. When data from such a column is retrieved, the SQL Server ODBC driver pads it with blanks on the right. However, data that is created in operations performed by SQL Server, such as concatenation, does not have such padding.
SQL_LONGVARBINARY, SQL_LONGVARCHAR, SQL_WLONGVARCHAR Updates of columns with SQL_LONGVARBINARY, SQL_LONGVARCHAR, or SQL_WLONGVARCHAR data types (using a WHERE clause) that affect multiple rows are fully supported when connected to SQL Server 6.x and later. When connected to SQL Server 4.2x, an S1000 error “Partial insert/update. The insert/update of a text or image column(s) did not succeed” is returned if the update affects more than one row.
String function parameters string_exp parameters to the string functions must be of data type SQL_CHAR or SQL_VARCHAR. SQL_LONG_VARCHAR data types are not supported in the string functions. The count parameter must be less than or equal to 8,000 because the SQL_CHAR and SQL_VARCHAR data types are limited to a maximum length of 8,000 characters. When connected to SQL Server 6.5 or earlier, the limit is 255 instead of 8000.
Time literals Time literals, when stored in a SQL_TIMESTAMP column (SQL Server data types of datetime or smalldatetime), have a date value of January 1, 1900.
timestamp Only a NULL value can be manually inserted into a timestamp column. However, because timestamp columns are automatically updated by SQL Server, a NULL value is overwritten.
tinyint The SQL Server tinyint data type is unsigned. A tinyint column is bound to a variable of data type SQL_C_UTINYINT by default.
User-defined data types When connected to SQL Server 4.2x, the SQL Server ODBC driver adds NULL to a column definition that does not explicitly declare a column’s nullability. Therefore, the nullability that is stored in the definition of a user-defined data type is ignored.
When connected to SQL Server 4.2x, columns with a user-defined data type that has a base data type of char or binary and for which no nullability is declared are created as data type varchar or varbinary. SQLColAttribute, SQLColumns, and SQLDescribeCol return SQL_VARCHAR or SQL_VARBINARY as the data type for these columns. Data that is retrieved from these columns is not padded.

LONG data types data-at-execution parameters are restricted for both the SQL_LONGVARBINARY and the SQL_LONGVARCHAR data types.


 



(c) 1988-98 Microsoft Corporation. All Rights Reserved.


Avatar billede funstuff.dk Nybegynder
10. oktober 2001 - 21:00 #8
hmm det er da ik det de hedder i sql 2000??
Avatar billede terry Ekspert
10. oktober 2001 - 21:00 #9
As I mentioned in my answer it woul take ages to giv eyou the EXACT answer your looking for.
In the books online you can see quite a bit of informationa swhat each can hold and its limitations.
Avatar billede funstuff.dk Nybegynder
10. oktober 2001 - 21:00 #10
ok, takker
Avatar billede terry Ekspert
10. oktober 2001 - 21:04 #11
This is taken from the books online (cut paste) so the formatting isnt so good. But there are three columns Data Type SQL Server Data Type and Description The middle column ii sth ename you are looking for.
Avatar billede terry Ekspert
10. oktober 2001 - 21:05 #12
selv tak :o)
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