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.

If you are using the cursor variable form, there are five possible return values:<br />

❑ 1 — The cursor is open. If the cursor is dynamic, its result set has zero or more rows. If the cursor<br />

is not dynamic, it has one or more rows.<br />

❑ 0 — The result set is empty.<br />

❑ -1 — The cursor is closed.<br />

❑ -2 — There is no cursor assigned to the cursor variable.<br />

❑ -3 — The variable with name cursor variable does not exist, or if it does exist, has not had a<br />

cursor allocated to it yet.<br />

Date and T ime Functions<br />

This is an area with several new items in <strong>SQL</strong> <strong>Server</strong> <strong>2008</strong>. In addition to working with timestamp data<br />

(which is actually more oriented toward versioning than anything to do with a clock or calendar), date<br />

and time functions perform operations on values that have any of the various date and time data types<br />

supported by <strong>SQL</strong> <strong>Server</strong>.<br />

When working with many of these functions, <strong>SQL</strong> <strong>Server</strong> recognizes eleven “dateparts” and their abbreviations,<br />

as shown in the following table:<br />

Datepart Abbreviations<br />

year yy, yyyy<br />

quarter qq, q<br />

month mm, m<br />

dayofyear dy, y<br />

day dd, d<br />

week wk, ww<br />

weekday dw<br />

hour hh<br />

minute mi, n<br />

second ss, s<br />

millisecond ms<br />

Apendix A: System Functions<br />

605

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

Saved successfully!

Ooh no, something went wrong!