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.

SignByCert<br />

Returns a varbinary(8000) containing the resulting signature provided a given certificate and plain text<br />

value:<br />

SignByCert(, [, ‘’])<br />

VerifySignedByAsymKey<br />

Returns an int (again, I think this odd since it is functionally a bit) indicating successful or failed validation<br />

of a signature against a given asymmetric key and plain text value:<br />

VerifySignedByAsymKey(, , )<br />

VerifySignedByCert<br />

Returns an int (though, personally I think this odd since it is functionally a bit) indicating successful or<br />

failed validation of a signature against a given asymmetric key and plain text value:<br />

VerifySignedByCert(, , )<br />

Cursor Functions<br />

These provide various information on the status or nature of a given cursor.<br />

@@CURSOR_ROWS<br />

Apendix A: System Functions<br />

Returns how many rows are currently in the last cursor set opened on the current connection. Note that<br />

this is for cursors, not temporary tables.<br />

Keep in mind that this number is reset every time you open a new cursor. If you need to open more than<br />

one cursor at a time, and you need to know the number of rows in the first cursor, then you’ll need to<br />

move this value into a holding variable before opening subsequent cursors.<br />

It’s possible to use this to set up a counter to control your WHILE loop when dealing with cursors, but I<br />

strongly recommend against this practice — the value contained in @@CURSOR_ROWS can change depending<br />

on the cursor type and whether <strong>SQL</strong> <strong>Server</strong> is populating the cursor asynchronously or not. Using<br />

@@FETCH_STATUS is going to be far more reliable and at least as easy to use.<br />

If the value returned is a negative number larger than –1, then you must be working with an asynchronous<br />

cursor, and the negative number is the number of records so far created in the cursor. If, however,<br />

the value is –1, then the cursor is a dynamic cursor, in that the number of rows is constantly changing. A<br />

returned value of 0 informs you that either no cursor opened has been opened, or the last cursor opened<br />

is no longer open. Finally, any positive number indicates the number of rows within the cursor.<br />

To create an asynchronous cursor, set sp_configure cursor threshold to a value greater than<br />

0. Then, when the cursor exceeds this setting, the cursor is returned, while the remaining records are<br />

placed into the cursor asynchronously.<br />

603

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

Saved successfully!

Ooh no, something went wrong!