17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A: System Functions<br />

SUM<br />

The SUM function will return the total of all values in expression. The syntax is as follows:<br />

SUM([ALL | DISTINCT] )<br />

SUM ignores NULL values. This function supports the OVER operator described in the ranking functions<br />

section of this appendix.<br />

VAR<br />

The VAR function returns the variance of all values in expression. The syntax is as follows:<br />

VAR()<br />

VAR ignores NULL values. This function supports the OVER operator described in the ranking functions<br />

section of this appendix.<br />

VARP<br />

The VARP function returns the variance for the population of all values in expression. The syntax is as<br />

follows:<br />

VARP()<br />

VARP ignores NULL values. This function supports the OVER operator described in the ranking functions<br />

section of this appendix.<br />

Configuration Functions<br />

Well, I’m sure it will come as a complete surprise (ok, not really…), but configuration functions are those<br />

functions that tell us about options as they are set for the current server or database (as appropriate).<br />

@@DATEFIRST<br />

594<br />

Returns the numeric value that corresponds to the day of the week that the system considers the first<br />

day of the week.<br />

The default in the United States is 7, which equates to Sunday. The values convert as follows:<br />

❑ 1 — Monday (the first day for most of the world)<br />

❑ 2 — Tuesday<br />

❑ 3 — Wednesday

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!