JavaScript EditorDhtml editor     Free javascript download 

Main Page

Extended stored procedures, packaged as dynamic-link libraries (DLLs), provide a way to extend SQLВ Server functionality through functions developed with Visual C++. Extended stored procedures are implemented as functions inside DLLs. In addition to functions, extended stored procedures can also define user-defined types and aggregate functions (such as SUM or AVG).

When a client executes an extended stored procedure, SQLВ Server searches for the DLL associated with the extended stored procedure and loads the DLL. SQLВ Server calls the requested extended stored procedure and executes it under a specified security context. The extended stored procedure then passes result sets and returns parameters back to the server.

SQL Server 2005 provides extensions to Transact-SQL (T-SQL) to allow you to install verifiable assemblies into SQLВ Server. The SQLВ Server permission set specifies the security context, with the following levels of security:

Safe mode requires the executed assemblies to be verifiably typesafe.

To create and load a verifiable assembly into SQLВ Server, use the Transact-SQL commands CREATE ASSEMBLY and DROP ASSEMBLY as follows:

В CopyCode imageCopy Code
CREATE ASSEMBLY <assemblyName> FROM <'Assembly UNC Path'> WITH 
  PERMISSION_SET <permissions>
DROP ASSEMBLY <assemblyName>

The PERMISSION_SET command specifies the security context, and can have the values UNRESTRICTED, SAFE, or EXTENDED.

In addition, you can use the CREATE FUNCTION command to bind to method names in a class:

В CopyCode imageCopy Code
CREATE FUNCTION <FunctionName>(<FunctionParams>)
RETURNS returnType
[EXTERNAL NAME <AssemblyName>:<ClassName>::<StaticMethodName>]

Expand imageExample

Expand imageSee Also

JavaScript EditorDhtml editor     Free javascript download