Как в SQL запросе ограничивать кол-во десятичных знаков?
Вопрос:
Как ограничить количество десятичных знаков после запятой в
создаваемом в запросе поле Skidka и Summa.
Select (Cena*0.98) As Skidka,(Cena*Koef) As Summa From tblTabl
Ответ:
Select ROUND(Cena*0.98,2) As Skidka,ROUND(Cena*Koef,2) As Summa From tblTabl
ROUND
Returns a numeric expression, rounded to the specified length or precision.
Is an expression of the exact numeric or approximate numeric data type
category, except for the bit data type.
length
Is the precision to which numeric_expression is to be rounded. length must be
tinyint, smallint, or int. When length is a positive number,
numeric_expression is rounded to the number of decimal places specified by
length. When length is a negative number, numeric_expression is rounded on the
left side of the decimal point, as specified by length.
function
Is the type of operation to perform. function must be tinyint, smallint, or
int. When function is omitted or has a value of 0 (default),
numeric_expression is rounded. When a value other than 0 is specified,
numeric_expression is truncated.
Return Types
Returns the same type as numeric_expression.
Remarks
ROUND always returns a value. If length is negative and larger than the
number of digits before the decimal point, ROUND returns 0.
Example Result
ROUND(748.58, -4) 0
ROUND returns a rounded numeric_expression, regardless of data type, when
length is a negative number.
Подскажите, пожалуйста, как узнать из программы на VBA в Excel выбрана ли команда "Автофильтр" из меню "Данные"->"Фильтр" (иначе говоря, установлена ли галочка рядом с командой "Автофильтр").