|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: What Are the Mathematical Functions Supported by SQL Server 2005?
Answer: SQL Server 2005 supports 23 mathematical functions: ABS, ACOS, ASIN, ATAN, ATN2, CEILING, COS, COT, DEGREES, EXP, FLOOR, LOG, LOG10, PI, POWER, RADIANS, RAND, ROUND, SIGN, SIN, SQRT, SQUARE, and TAN. The return data types of mathematical functions are determined by two rules:
* Arithmetical functions: ABS, CEILING, DEGREES, FLOOR, POWER, RADIANS, and SIGN are returning the same data type as the input values. No implicit data type conversions are performed. * Other mathematical functions: COS, COT, EXP, LOG, LOG10, SIN, SQRT, SQUARE and TAN are taking only FLOAT data type as input and returning FLOAT data type. Implicit data type conversion will be performed if you are calling these functions with a non-FLOAT data type. The tutorial exercise gives you some good examples on how to use mathematical functions:
-- ABS retuns the same data type as the input
DECLARE @x FLOAT(53);
DECLARE @y NUMERIC(9,2);
DECLARE @z INT;
SET @x = -12345.123456789E+20;
SET @y = -12345.12;
SET @z = -12345
SELECT ABS(@x);
SELECT ABS(@y);
SELECT ABS(@z);
GO
1.2345123456789E+24
12345.12
12345
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7224 users |
Added on |
9/23/2014 |
Views |
66809 |
Rate it! |
|
|
Question:
What Are the Mathematical Functions Supported by SQL Server 2005?
Answer:
SQL Server 2005 supports 23 mathematical functions: ABS, ACOS, ASIN, ATAN, ATN2, CEILING, COS, COT, DEGREES, EXP, FLOOR, LOG, LOG10, PI, POWER, RADIANS, RAND, ROUND, SIGN, SIN, SQRT, SQUARE, and TAN. The return data types of mathematical functions are determined by two rules:
* Arithmetical functions: ABS, CEILING, DEGREES, FLOOR, POWER, RADIANS, and SIGN are returning the same data type as the input values. No implicit data type conversions are performed. * Other mathematical functions: COS, COT, EXP, LOG, LOG10, SIN, SQRT, SQUARE and TAN are taking only FLOAT data type as input and returning FLOAT data type. Implicit data type conversion will be performed if you are calling these functions with a non-FLOAT data type. The tutorial exercise gives you some good examples on how to use mathematical functions:
-- ABS retuns the same data type as the input
DECLARE @x FLOAT(53);
DECLARE @y NUMERIC(9,2);
DECLARE @z INT;
SET @x = -12345.123456789E+20;
SET @y = -12345.12;
SET @z = -12345
SELECT ABS(@x);
SELECT ABS(@y);
SELECT ABS(@z);
GO
1.2345123456789E+24
12345.12
12345 Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What Happens When Converting Big Values to NUMERIC Data Types?
|
View Answer
|
|
What Happens When Converting Big Values to Integers?
|
View Answer
|
|
How To Convert Character Strings into Numeric Values?
|
View Answer
|
|
How To How To Convert Numeric Expression Data Types using the CONVERT() Function??
|
View Answer
|
|
How To Convert Numeric Expression Data Types using the CAST() Function?
|
View Answer
|
|
How To Convert Numeric Expression Data Types by Assignment Operations?
|
View Answer
|
|
How To Convert a Numeric Expression from One Data Type to Another?
|
View Answer
|
|
What Is an Expression in MS SQL Server?
|
View Answer
|
|
What Are the Underflow and Overflow Behaviors on FLOAT Literals?
|
View Answer
|
|
How REAL and FLOAT Literal Values Are Rounded?
|
View Answer
|
|
How Extra Digits Are Handled with NUMERIC Data Type Literals?
|
View Answer
|
|
What Happens If an Integer Is Too Big for INT Date Type?
|
View Answer
|
|
What Are Out-of-Range Errors with Date and Time Literals?
|
View Answer
|
|
What Happens If Time-Only Values Are Provided as Date and Time Literals?
|
View Answer
|
|
What Happens If Date-Only Values Are Provided as Date and Time Literals?
|
View Answer
|
|
Why I Can Not Enter 0.001 Second in Date and Time Literals in MS SQL Server?
|
View Answer
|
|
How To Enter Date and Time Literals in MS SQL Server?
|
View Answer
|
|
How To Enter Binary String Literals in MS SQL Server?
|
View Answer
|
|
How To Enter Unicode Character String Literals in MS SQL Server?
|
View Answer
|
|
How Fixed Length Strings Are Truncated and Padded?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All MS SQL Server Interview Questions & Answers - Exam Mode /
Learning Mode
|