Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Базы";
Текущий архив: 2004.09.26;
Скачать: [xml.tar.bz2];

Вниз

размерность   Найти похожие ветки 

 
NewDelpher   (2004-08-31 13:12) [0]

Еще раз ламерский вопрос. Когда я в Enterprise Manager-е задаю тип поля DECIMAL, то Length ставится равный 9, а внизу в свойствах есть Precission = 18.  Если Length - это длина поля в знаках, тогда что значит Precission = (18,2)?


 
stone ©   (2004-08-31 13:22) [1]

9 - это кол-во байт, занимаемое полем

ЗЫ. Да поможет тебе BOL


 
Ega23 ©   (2004-08-31 13:23) [2]


Precision, Scale, and Length
Precision is the number of digits in a number. Scale is the number of digits to the right of the decimal point in a number. For example, the number 123.45 has a precision of 5 and a scale of 2.

The default maximum precision of numeric and decimal data types is 38. In previous versions of SQL Server, the default maximum was 28.

Length for a numeric data type is the number of bytes used to store the number. Length for a character string or Unicode data type is the number of characters. The length for binary, varbinary, and image data types is the number of bytes. For example, an int data type can hold 10 digits, is stored in 4 bytes, and does not accept decimal points. The int data type has a precision of 10, a length of 4, and a scale of 0.

When two char, varchar, binary, or varbinary expressions are concatenated, the length of the resulting expression is the sum of the lengths of the two source expressions or 8,000 characters, whichever is less.

When two nchar or nvarchar expressions are concatenated, the length of the resulting expression is the sum of the lengths of the two source expressions, or 4,000 characters, whichever is less.

The precision and scale of the numeric data types besides decimal are fixed. If an arithmetic operator has two expressions of the same type, then the result has the same data type with the precision and scale defined for that type. If an operator has two expressions with different numeric data types, then the rules of data type precedence define the data type of the result. The result has the precision and scale defined for its data type.

This table defines how the precision and scale of the result are calculated when the result of an operation is of type decimal. The result is decimal when:

Both expressions are decimal.

One expression is decimal and the other is a data type with a lower precedence than decimal.
The operand expressions are denoted as expression e1, with precision p1 and scale s1, and expression e2, with precision p2 and scale s2. The precision and scale for any expression that is not decimal is the precision and scale defined for the data type of the expression.

Operation Result precision Result scale *
e1 + e2 max(s1, s2) + max(p1-s1, p2-s2) + 1 max(s1, s2)
e1 - e2 max(s1, s2) + max(p1-s1, p2-s2) max(s1, s2)
e1 * e2 p1 + p2 + 1 s1 + s2
e1 / e2 p1 - s1 + s2 + max(6, s1 + p2 + 1) max(6, s1 + p2 + 1)

* The result precision and scale have an absolute maximum of 38. When a result precision is greater than 38, the corresponding scale is reduced to prevent the integral part of a result from being truncated.

©1988-2000 Microsoft Corporation. All Rights Reserved.


Читай почаще Books OnLine и будет тебе счастье!


 
NewDelpher   (2004-08-31 13:27) [3]

СПАСИБО!



Страницы: 1 вся ветка

Форум: "Базы";
Текущий архив: 2004.09.26;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.45 MB
Время: 0.032 c
4-1091517105
volser
2004-08-03 11:11
2004.09.26
Ярлыки


1-1094633983
Koala
2004-09-08 12:59
2004.09.26
Удаление файла


1-1094641220
Cosinus
2004-09-08 15:00
2004.09.26
Значение ошибки "External Exception 0xXXXXXXXX"&


1-1094717864
stone
2004-09-09 12:17
2004.09.26
Format в Synchronize


14-1093099932
mm0
2004-08-21 18:52
2004.09.26
Как надо было пройте последний уровень в DOOM_2(1994)





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский