--************************************************************************************** -- Date: March 10, 2004 -- -- File: Test.sql for T-SQL Surrogate-aware String Functions Example -- -- Summary: Test script for sample. -- --************************************************************************************** -- -- This file is part of the Microsoft SQL Server Code Samples. -- Copyright (C) 2003 Microsoft Corporation. All rights reserved. -- -- This source code is intended only as a supplement to Microsoft -- Development Tools and/or on-line documentation. See these other -- materials for detailed information regarding Microsoft code samples. -- -- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY -- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -- PARTICULAR PURPOSE. -- --************************************************************************************** Use [AdventureWorks] Go -- left_s VS Left print ('***** left_s VS Left *****'); select [dbo].[left_s](N'𠱷𠱸123',2); print(N'Should Return 𠱷𠱸'); go select Left(N'𠱷𠱸123',2); print(N'Will Return 𠱷'); go -- right_s VS Right print ('***** right_s VS Right *****') select [dbo].[right_s](N'𠱷𠱸123',5); print(N'Should Return 𠱷𠱸123'); go select Right(N'𠱷𠱸123',5); print(N'Will Return 𠱸123'); go -- len_s VS Len print('***** len_s VS Len *****'); select [dbo].[len_s](N'𠆾𠇀𠇃12'); print(N'Should Return 5'); go select Len(N'𠆾𠇀𠇃12'); print(N'Will Return 8'); go -- sub_s VS Substring print('***** sub_s VS Subscription *****'); select [dbo].[sub_s] (N'𢙢𢙣𢙤𢙥𢙦𢙧𢙨𢙩𢙪𢙫𢙬𢙭𢙮𢙯𢙰𢙱𢙲𢙳',3,5); print(N'Should Return 𢙤𢙥𢙦𢙧𢙨'); go select substring(N'𢙢𢙣𢙤𢙥𢙦𢙧𢙨𢙩𢙪𢙫𢙬𢙭𢙮𢙯𢙰𢙱𢙲𢙳',3,5); print(N'Will Return 𢙣𢙤'); go -- replace_s VS Replace print('***** replace_s VS Replace *****'); select [dbo].[replace_s](N'𡥕𡥖𡥗𡥙𡥚𡥛𡥕𡥖𡥗𡥙𡥚𡥛',N'𡥗𡥙𡥚',N'𡦼'); print(N'Should Return 𡥕𡥖𡦼𡥛𡥕𡥖𡦼𡥛'); go select replace(N'𡥕𡥖𡥗𡥙𡥚𡥛𡥕𡥖𡥗𡥙𡥚𡥛',N'𡥗𡥙𡥚',N'𡦼'); print(N'Will Return 𡦼'); go