Tags: ima binary is com LAN automatic tin application OKThere are two characteristics of data in a computer: type and length. The so-called data types are the types of data that are divided by the way data is represented and stored.Each variable, parameter, expression, and so on in SQL Server has a data type. The data
(9223372036854775807.INT: integer data from-2 ^ 31 (-2,147,483,648) to 2 ^ 31-1 (2,147,483,647.Smallint: integer data from-2 ^ 15 (-32,768) to 2 ^ 15-1 (32,767.Tinyint: integer data from 0 to 255.Bit: an integer of 1 or 0.
(4) decimal and numericThe two data types are equivalent. There are two parameters: P (precision) and S (number of decimal places ). P indicates that the Left and Right decimal places can be storedThe maximum number of decimal numb
with a maximum length of 8000Varchar: Variable Length non-Unicode bytes data, maximum length: 8000Text: Variable Length non-Unicode bytes data. The maximum length is 2 ^ 31-1 (2g)
Nchar: bytes data with a fixed length of Unicode. The maximum length is 8000.Nvarchar: variable-length Unicode bytes. The maximum length is 8000.Ntext: String-type data with Extended Unicode length. The maximum length is 2 ^ 31-1 (2g)
Binary: binary data with a fixed length. The maximum length is 8000.Varbinary: va
up, rounding down, and rounding to zero. Microsoft®sql Server™ used on rounding. All values must be accurate to a definite precision, but will produce a small floating-point value change. Because the binary representation of floating-point numbers can take any one of many legitimate rounding rules, it is not possible to reliably quantify a floating-point value.Convert decimal and numeric dataFor decimal an
After years of controversy, Microsoft finally cut the date-time data type, adding 4 new date-time data types in one breath in the new version of SQL Server 2008, including:
Date: A pure date data type.
Time: A pure temporal data type.
DateTime2: A new datetime type that mentions precision to 100 nanoseconds.
DateTimeOffset: The new datetime t
part of SQL Server replication. You cannot specify a with encryption for a CLR trigger.
EXECUTE as
Specifies the security context used to execute the trigger. Allows you to control the user account that the SQL Server instance uses to authenticate the permissions of any database object referenced by the trigger.
fo
Tags: intent lock hierarchy span advanced existing pad content create pictureLock: Popular speaking is to add lock. Locking is a mechanism that the Microsoft SQL Server database engine uses to synchronize access to the same block of data by multiple users at the same time.Definition: When there are transactional operations, the database engine requires different types
Excel|server
SET ansi_nulls off
Go
SET NOCOUNT on
Go
SET LANGUAGE ' Simplified Chinese '
Go
DECLARE @tbl nvarchar (@fld nvarchar), @sql nvarchar (4000), @maxlen int, @sample nvarchar (40)
SELECT d.name tablename,a.name fieldname,b.name typename,a.length length,a.isnullable into #t
From Syscolumns A, systypes b,sysobjects D
WHERE A.xtype=b.xusertype and A.id=d
, 1753 to December 31, 9999, the accuracy is 3.33 milliseconds.
8 bytes
DateTime2
From January 1, 1753 to December 31, 9999, the accuracy is 100 nanoseconds.
6-8 bytes
smalldatetime
From January 1, 1900 to June 6, 2079, the accuracy is 1 minutes.
4 bytes
Date
Only dates are stored. From January 1, 01 to December 31, 9999.
3 bytes
Time
Storage time only. The accuracy is 100 nanoseconds.
3-5 by
I. Scenarios
In SQL Server 2005, there is a table TestDatetime, where the data type of the Dates field is datetime. If you see a table record, what do you first think?
(Figure 1: Data List)
When you see this data, do you think this design is a waste of storage space and makes the index of this column increase, making the query slower, you also want to use some other data
Differences between varchar and nvarchar:
Varchar (n)Variable-length and non-Unicode character data with a length of n Bytes. N must be a value between 1 and 8,000. The storage size is the actual length of the input data bytes, rather than n Bytes (such as varchar (6). When the field is qqq, the actual space occupied by the database is 3 bytes, instead of 6 bytes, it can only store 6 bytes. Generally, Chinese occupies two bytes ).
Nvarchar (n)Unicode data with a variable length of n characters.
MS SQL Server 2000 system data type:
(from SQL Query Analyzer)
1bigint Integer (integer) data from -2^63 to 2^63-1
2binary fixed-length binary data, up to 8,000 bytes
3bit integer data with a value of 1 or 0
4char fixed-length non-Unicode character data, 8,000 characters long
5cursor the data type used for a variable or stored procedure output parameter that cont
-length data, and the index on achar field is highly efficient, such as defining char(10), which takes up 10 bytes of space regardless of whether the data you store is 10 bytes.
VARCHARStore variable length data, but the storage efficiency is not high, if the value of a field may be not fixed length, we only know it cannot exceed 10 characters, it is the most advantageous to define it as VARCHAR(10). The actual length of the VARCHAR type is +1 of the actual length of its value. Why "+1"? Th
Tags: BSP double absolute value Variable eval front end data type decimal addThere are two characteristics of data in a computer: type and length. The so-called data types are the types of data that are divided by the way data is represented and stored.Each variable, parameter, expression, and so on in SQL Server has a
The date and time data from January 1, January 1-20, 1900 to January 1, June 6 are accurate to minutes.String
Char
A fixed length of non-Unicode characters. The maximum length is 8,000 characters.
Varchar
Variable-length non-Unicode data, which can contain a maximum of 8,000 characters.
Text
Variable-length non-Unicode data. The maximum length is 2 ^ 31-1 (2,147,483,647) characters.Unicode string
Nchar
Unicode data of a fixed length. The maximum length is 4,000 characters.
Nvarchar
A variable-l
There are many types of ASP. NET database operation code. Today, let's take a look at four typical types of SQL Server code.
DataReader for ASP. NET database operation code
Function: DataReader reading class, which reads data only forward.
Read-only and inbound data streams. Because there is only one row of data in the
ArticleDirectory
Preface
Preface
PostgreSQL 8.1 was launched. I plan to migrate some SQL server applications to PostgreSQL. The first thing I need to migrate is tables, therefore, we must first figure out the ing relationship between the data types in the two databases. I checked the PostgreSQL documentation and made the following table to help you.
Unicode Character Set is generated to solve the incompatibility problem of character sets. All its characters are expressed in two bytes, that is, English characters are also expressed in two bytes.If you are still struggling with this issue, let's take a look at the explanation below and make a decision.Generally, if you use Chinese characters or other special characters, I will use the type starting with n. Otherwise, I will directly start with var.What is the difference between varchar and Nv
1. Exact numeric type
Bigint
Int
Smallint
Tinyint
Bit
Money
Smallmoney
2. Balanced Data Type, Ms is recommendedVarchar (max)Replace text
Char
Varchar
Text
3. Approximate numeric type
Decimal
Numeric
Real
Float
4. Unicode string type
Nchar
Nvarchar
Ntext
5. binary data type,Recommended varbinary for MS(Max)In place of the image data type,Max =231-1
Binary (N)Stores fixed-length binary data
Varbinary(N)Stores variable-length binary data in the range of N~ (1,8000)
Image Stores image information
6.
In SQL, the varchar type is converted to int and then sorted, if our database ID is set to varchar type, the order by ID when queried.If the ID of our database is set to the varchar type of the order by ID at the time of the query, we do not want to see the following situation.We can convert varchar to int and then sortOneCopy CodeThe code is as follows:SELECT * from Yourtable order by cast (yourcol as int);For SQ
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.