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 RAND The RAND function returns a random value between 0 and 1. The syntax is as follows: RAND([]) The optional seed value is an integer expression, which specifies a start value to be used in random number generation. You can allow SQL Server to generate its own random seed value each time you call it, or you can specify your own. ROUND Be careful when specifying a literal seed value. Given a specific seed value, SQL Server will always return the same result (meaning your RAND is suddenly not random at all). If you truly need a random number generated, then either allow SQL Server to select a random seed for you, or use a constantly changing seed such as the number of nanoseconds since a particular point in time. The ROUND function takes a number specified in expression and rounds it to the specified length: ROUND(, [, ]) The length parameter specifies the precision to which expression should be rounded. The length parameter should be of the tinyint, smallint, or int data type. The optional function parameter can be used to specify whether the number should be rounded or truncated. If a function value is omitted or is equal to 0 (the default), the value in expression will be rounded. If any value other than 0 is provided, the value in expression will be truncated. SIGN SIN The SIGN function returns the sign of the expression. The possible return values are +1 for a positive number, 0 for zero, and -1 for a negative number. The syntax is as follows: SIGN() The SIN function returns the sine of an angle. The syntax is as follows: SIN() The angle should be in radians and must be of the float data type. The return value will also be of the float data type. SQRT 614 The SQRT function returns the square root of the value given in expression. The syntax is as follows: SQRT()
The expression must be of the float data type. SQUARE TAN The SQUARE function returns the square of the value given in expression. The syntax is as follows: SQUARE() The expression must be of the float data type. The TAN function returns the tangent of the value specified in expression. The syntax is as follows: TAN() The expression parameter specifies the number of radians and must be of the float or real data type. Basic Metadata Functions The metadata functions provide information about the database and database objects. They are: ❑ COL_LENGTH ❑ COL_NAME ❑ COLUMNPROPERTY ❑ DATABASEPROPERTY ❑ DATABASEPROPERTYEX ❑ DB_ID ❑ DB_NAME ❑ FILE_ID ❑ FILE_NAME ❑ FILEGROUP_ID ❑ FILEGROUP_NAME ❑ FILEGROUPPROPERTY ❑ FILEPROPERTY ❑ FULLTEXTCATALOGPROPERTY ❑ FULLTEXTSERVICEPROPERTY ❑ INDEX_COL Apendix A: System Functions 615
- 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 630 and 631: Appendix A: System Functions CHECKS
- 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 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
- Page 680 and 681: Appendix A: System Functions HOST_I
- Page 682 and 683: Appendix A: System Functions NULLIF
- Page 684 and 685: Appendix A: System Functions 646 Pr
- Page 686 and 687: Appendix A: System Functions Text a
- Page 688 and 689: Appendix B: Very Simple Connectivit
- Page 690 and 691: Appendix B: Very Simple Connectivit
- Page 692 and 693: Appendix B: Very Simple Connectivit
- Page 694 and 695: Appendix B: Very Simple Connectivit
- Page 696 and 697: ABS function A ABS function, 611 AC
- Page 698 and 699: closing tags closing tags, XML docu
- Page 700 and 701: cryptographic functions (continued)
Appendix A: System Functions<br />
RAND<br />
The RAND function returns a random value between 0 and 1. The syntax is as follows:<br />
RAND([])<br />
The optional seed value is an integer expression, which specifies a start value to be used in random<br />
number generation. You can allow <strong>SQL</strong> <strong>Server</strong> to generate its own random seed value each time you call<br />
it, or you can specify your own.<br />
ROUND<br />
Be careful when specifying a literal seed value. Given a specific seed value, <strong>SQL</strong> <strong>Server</strong> will always<br />
return the same result (meaning your RAND is suddenly not random at all). If you truly need a<br />
random number generated, then either allow <strong>SQL</strong> <strong>Server</strong> to select a random seed for you, or use<br />
a constantly changing seed such as the number of nanoseconds since a particular point in time.<br />
The ROUND function takes a number specified in expression and rounds it to the specified length:<br />
ROUND(, [, ])<br />
The length parameter specifies the precision to which expression should be rounded. The length<br />
parameter should be of the tinyint, smallint, or int data type. The optional function parameter<br />
can be used to specify whether the number should be rounded or truncated. If a function value is<br />
omitted or is equal to 0 (the default), the value in expression will be rounded. If any value other than 0<br />
is provided, the value in expression will be truncated.<br />
SIGN<br />
SIN<br />
The SIGN function returns the sign of the expression. The possible return values are +1 for a positive<br />
number, 0 for zero, and -1 for a negative number. The syntax is as follows:<br />
SIGN()<br />
The SIN function returns the sine of an angle. The syntax is as follows:<br />
SIN()<br />
The angle should be in radians and must be of the float data type. The return value will also be of the<br />
float data type.<br />
SQRT<br />
614<br />
The SQRT function returns the square root of the value given in expression. The syntax is as follows:<br />
SQRT()