ลงดูครับ ผมเคยใช้โดยเขียนสร้างไว้ใน SQL Server -> Stored Procedure -> Function -> Sclar...
Code (DecodeUnicodeData)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
/*
For convert to Japanese Character.
*/
ALTER FUNCTION [dbo].[DecodeUnicodeData](@DATA NVARCHAR(4000), @PREFIX VARCHAR(100), @Suffix VARCHAR(100))
RETURNS NVARCHAR(4000)
AS
BEGIN
DECLARE @START INT
DECLARE @END INT
WHILE CHARINDEX(@PREFIX, @DATA) > 0
BEGIN
SET @START = CHARINDEX(@PREFIX, @DATA)
SET @END = CHARINDEX(@Suffix, @DATA, @START)
SET @DATA = REPLACE(@DATA, SUBSTRING(@DATA, @START, @END -@START + LEN(@Suffix)),NCHAR(SUBSTRING(@DATA, @START+ LEN(@PREFIX),@END -@START - LEN(@PREFIX))))
END
RETURN @DATA
END
ตอนเรียกใช้ก็ SELECT DecodeUnicodeData(Column) FROM table1