Readme_Supplementary-Aware String Manipulation Sample
This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.
The StringManipulate sample for Microsoft SQL Server demonstrates supplementary character aware string processing. This sample shows the implementation of five Transact-SQL string functions that provide the same string manipulation functions as the built-in functions, but with additional supplementary character-aware capability to handle both Unicode and supplementary character strings. The five functions are len_s(), left_s(), right_s(), sub_s() and replace_s() which are equivalent to the built-in functions LEN(), LEFT(), RIGHT(), SUBSTRING() and REPLACE() string functions.
|When compiling common language runtime (CLR) integration samples, the path of the version of the Microsoft .NET Framework compiler that was included with SQL Server must be the first Framework directory in the PATH environment variable. The location of the compiler that was included with SQL Server is either drive:\WINNT\Microsoft.NET\Framework\v2.0.xxxxx or drive:\Windows\Microsoft.NET\Framework\v2.0.xxxxx, where drive is the installation drive and xxxxx is the version of the .NET Framework that was included with SQL Server.|
Default Location: C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\CLR\StringManipulate
SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see Considerations for Installing SQL Server Samples and Sample Databases.
Before running this sample, make sure the following software is installed:
Microsoft SQL Server or Microsoft SQL Server Express. You can obtain SQL Server Express free of charge from the SQL Server Express Documentation and Samples Web site
The AdventureWorks database that is available at the SQL Server Developer Web site.
The SQL Server Database Engine samples that are available at the SQL Server Developer Web site.
.NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. See Installing the .NET Framework Documentation.
Ext-B font must be installed on the computer for the correct characters to appear in the SQL Server Management Studio results window. To change the font in the results window, in Management Studio, on the Tools menu, click Options, expand Environment, and then click Fonts and Colors. Set the font to MingLiU_ExtB for Text Results and/or Grid Results. You must close and then reopen Management Studio for the changes to take effect.
If you have not already created the strong-name key file ExternalSampleKey.snk, generate the key file using the following instructions.
Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft Visual Studio 2005, point to Visual Studio Tools, and then click Visual Studio 2005 Command Prompt.
Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
At the command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the Samples folder.
Note: To determine the folder where samples are located, click Start, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.
At the command prompt, run the following command to generate the key file:
sn -k ExternalSampleKey.snk
Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
To build the sample, do the following:
Compile the sample by using Visual Studio 2005 and the provided Visual Studio solution, or by using Microsoft MSBuild, which is included in the .NET Framework SDK 2.0. Run a command similar to the following at the command prompt:
msbuild /nologo /verbosity:quiet /property:Configuration=Debug CS\ StringManipulate.sln
Make sure that the AdventureWorks database is installed, or, if necessary, create the database in which you want to install the samples.
If you did not install the SQL Server Database Engine samples in the default location, modify the path in the CREATE ASSEMBLY part of the script in Scripts\InstallCS.sql and Scripts\InstallVB.sql to refer to location where the samples were installed.
Open the scripts\installCS.sql or scripts\installVB.sql file, depending on whether you compiled the Visual C# project or the Visual Basic project, in Management Studio. Run the script that is contained in the file, or run a command similar to the following at the command prompt:
sqlcmd -E -I -i Scripts\InstallCS.sql
This file contains script to install and register the sample CLR objects into SQL Server.
To run the sample, do the following:
To remove the StringManipulate sample, do the following:
The CLR for SQL Server 2008 or SQL Server Express must be enabled for this sample to work correctly.
Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.