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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix A: System Functions<br />

The query parameter is a string that is executed by the provider and is used instead of a combination of<br />

catalog, schema, and object.<br />

OPENXML<br />

By passing in an XML document as a parameter, or by retrieving an XML document and defining the<br />

document within a variable, OPENXML allows you to inspect the structure and return data, as if the XML<br />

document were a table. The syntax is as follows:<br />

OPENXML( [in], nvarchar[in],[ byte[in]])<br />

[WITH ( | )]<br />

The idoc_int parameter is the variable defined using the sp_xml_prepareddocument system sproc.<br />

Rowpattern is the node definition. The flags parameter specifies the mapping between the XML document<br />

and the rowset to return within the SELECT statement. SchemaDeclaration defines the XML<br />

schema for the XML document; if there is a table defined within the database that follows the XML<br />

schema, then TableName can be used instead.<br />

Before being able to use the XML document, it must be prepared by using the<br />

sp_xml_preparedocument system procedure.<br />

Security Functions<br />

The security functions return information about users and roles. They are:<br />

❑ HAS_DBACCESS<br />

❑ IS_MEMBER<br />

❑ IS_SRVROLEMEMBER<br />

❑ SUSER_ID<br />

❑ SUSER_NAME<br />

❑ SUSER_SID<br />

❑ USER<br />

❑ USER_ID<br />

❑ USER_NAME<br />

HAS_DBACCESS<br />

630<br />

The HAS_DBACCESS function is used to determine whether the user that is logged in has access to the<br />

database being used. A return value of 1 means the user does have access, and a return value of 0 means<br />

that he or she does not. A NULL return value means the database_name supplied was invalid. The syntax<br />

is as follows:<br />

HAS_DBACCESS (‘’)

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

Saved successfully!

Ooh no, something went wrong!