Beginning Microsoft SQL Server 2008 ... - S3 Tech Training
Beginning Microsoft SQL Server 2008 ... - S3 Tech Training Beginning Microsoft SQL Server 2008 ... - S3 Tech Training
Appendix A: System Functions CHECKSUM_AGG Like CHECKSUM, this is a basic hash algorithm usually used to detect changes or consistency in data. The primary difference is that CHECKSUM is oriented around rows, whereas CHECKSUM_AGG is oriented around columns. The basic syntax is: CHECKSUM_AGG( [ALL | DISTINCT] ) The expression value can be virtually anything, including, if you wish, concatenation of columns (just remember to cast as necessary); however, remember that expression order does matter, so if you’re concatenating, Col1 + Col2 does not equal Col2 + Col1. COUNT COUNT returns the number of items in expression. The data type returned is of type int. The syntax is as follows: COUNT ( [ALL | DISTINCT] | * ) The expression cannot be of the uniqueidentifier, text, image, or ntext data types. The * argument returns the number of rows in the table; it does not eliminate duplicate or NULL values. This function supports the OVER operator described in the ranking functions section of this appendix. COUNT_BIG COUNT_BIG returns the number of items in a group. This is very similar to the COUNT function just described, with the exception that the return value has a data type of bigint. The syntax is as follows: COUNT_BIG ( [ALL | DISTINCT ] | * ) Like COUNT, this function supports the OVER operator described in the ranking functions section of this appendix. GROUPING 592 GROUPING adds an extra column to the output of a SELECT statement. The GROUPING function is used in conjunction with CUBE or ROLLUP to distinguish between normal NULL values and those added as a result of CUBE and ROLLUP operations. Its syntax is: GROUPING ()
GROUPING is only used in the SELECT list. Its argument is a column that is used in the GROUP BY clause and that is to be checked for NULL values. This function supports the OVER operator described in the ranking functions section of this appendix. MAX The MAX function returns the maximum value from expression. The syntax is as follows: MAX([ALL | DISTINCT] ) MAX ignores any NULL values. This function supports the OVER operator described in the ranking functions section of this appendix. MIN The MIN function returns the smallest value from expression. The syntax is as follows: MIN([ALL | DISTINCT] ) MIN ignores NULL values. This function supports the OVER operator described in the ranking functions section of this appendix. STDEV The STDEV function returns the standard deviation of all values in expression. The syntax is as follows: STDEV() STDEV ignores NULL values. This function supports the OVER operator described in the ranking functions section of this appendix. STDEVP The STDEVP function returns the standard deviation for the population of all values in expression. The syntax is as follows: STDEVP() Apendix A: System Functions STDEVP ignores NULL values and supports the OVER operator described in the ranking functions section of this appendix. 593
- Page 580 and 581: Chapter 17: Reporting for Duty, Sir
- Page 582 and 583: Chapter 18: Getting Integrated with
- Page 584 and 585: Chapter 18: Getting Integrated with
- Page 586 and 587: Chapter 18: Getting Integrated with
- Page 588 and 589: Chapter 18: Getting Integrated with
- Page 590 and 591: Chapter 18: Getting Integrated with
- Page 592 and 593: Chapter 18: Getting Integrated with
- Page 594 and 595: Chapter 18: Getting Integrated with
- Page 596 and 597: Chapter 18: Getting Integrated with
- Page 598 and 599: Chapter 18: Getting Integrated with
- Page 601 and 602: 19 Playing Administrator And so, he
- Page 603 and 604: ❑ Write the information to the ev
- Page 605 and 606: Creating Jobs and Tasks Using Manag
- Page 607 and 608: Let’s go ahead and move on to the
- Page 609 and 610: Figure 19-8 Figure 19-9 Chapter 19:
- Page 611 and 612: Figure 19-11 Figure 19-12 Chapter 1
- Page 613 and 614: Backup and Reco very No database-dr
- Page 615 and 616: ❑ Differential: This might be ref
- Page 617 and 618: ❑ Simple: Under this model, the t
- Page 619 and 620: The older DBCC commands are still s
- Page 621 and 622: many rows inserted over time and th
- Page 623: Chapter 19: Playing Administrator T
- Page 626 and 627: Appendix A: System Functions In add
- Page 628 and 629: Appendix A: System Functions @@TOTA
- Page 632 and 633: Appendix A: System Functions SUM Th
- Page 634 and 635: Appendix A: System Functions The de
- Page 636 and 637: Appendix A: System Functions @@REMS
- Page 638 and 639: Appendix A: System Functions Cert_I
- Page 640 and 641: Appendix A: System Functions Encryp
- Page 642 and 643: Appendix A: System Functions @@FETC
- Page 644 and 645: Appendix A: System Functions CURREN
- Page 646 and 647: Appendix A: System Functions SYSDAT
- Page 648 and 649: Appendix A: System Functions GetRoo
- Page 650 and 651: Appendix A: System Functions The ex
- Page 652 and 653: Appendix A: System Functions RAND T
- Page 654 and 655: Appendix A: System Functions ❑ IN
- Page 656 and 657: Appendix A: System Functions ❑ Is
- Page 658 and 659: Appendix A: System Functions FILEGR
- Page 660 and 661: Appendix A: System Functions INDEX_
- Page 662 and 663: IsCheckCnst IsConstraint IsDefault
- Page 664 and 665: Appendix A: System Functions OBJECT
- Page 666 and 667: Appendix A: System Functions TYPEPR
- Page 668 and 669: Appendix A: System Functions The qu
- Page 670 and 671: Appendix A: System Functions The SU
- Page 672 and 673: Appendix A: System Functions ASCII
- Page 674 and 675: Appendix A: System Functions The ch
- Page 676 and 677: Appendix A: System Functions UNICOD
- Page 678 and 679: Appendix A: System Functions CAST a
Appendix A: System Functions<br />
CHECKSUM_AGG<br />
Like CHECKSUM, this is a basic hash algorithm usually used to detect changes or consistency in data. The<br />
primary difference is that CHECKSUM is oriented around rows, whereas CHECKSUM_AGG is oriented<br />
around columns. The basic syntax is:<br />
CHECKSUM_AGG( [ALL | DISTINCT] )<br />
The expression value can be virtually anything, including, if you wish, concatenation of columns (just<br />
remember to cast as necessary); however, remember that expression order does matter, so if you’re concatenating,<br />
Col1 + Col2 does not equal Col2 + Col1.<br />
COUNT<br />
COUNT returns the number of items in expression. The data type returned is of type int. The syntax is<br />
as follows:<br />
COUNT<br />
(<br />
[ALL | DISTINCT] | *<br />
)<br />
The expression cannot be of the uniqueidentifier, text, image, or ntext data types. The * argument<br />
returns the number of rows in the table; it does not eliminate duplicate or NULL values.<br />
This function supports the OVER operator described in the ranking functions section of this appendix.<br />
COUNT_BIG<br />
COUNT_BIG returns the number of items in a group. This is very similar to the COUNT function just<br />
described, with the exception that the return value has a data type of bigint. The syntax is as follows:<br />
COUNT_BIG<br />
(<br />
[ALL | DISTINCT ] | *<br />
)<br />
Like COUNT, this function supports the OVER operator described in the ranking functions section of this<br />
appendix.<br />
GROUPING<br />
592<br />
GROUPING adds an extra column to the output of a SELECT statement. The GROUPING function is used<br />
in conjunction with CUBE or ROLLUP to distinguish between normal NULL values and those added as a<br />
result of CUBE and ROLLUP operations. Its syntax is:<br />
GROUPING ()