Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
yipchunyu
Yak Posting Veteran
80 Posts |
Posted - 2005-09-01 : 03:22:57
|
| One table has a text field which is used html codes. I want to extract part of the string and so I create a function listed in the followings. However, it seems that the function can't display Chinese characters correctly. What should I do?CREATE FUNCTION dbo.ExtractAptLoc ( @Note text )RETURNS nvarchar(200)ASBEGINDeclare @StartPos intDeclare @EndPos intDECLARE @output nvarchar(200)select @StartPos = PATINDEX('%<loc>%', @Note) + 11select @EndPos = PATINDEX('%</loc>%', @Note) - @StartPos IF PATINDEX('%<loc>%', @Note) = 0 or PATINDEX('%</loc>%', @Note) = 0 BEGIN SET @output = Null ENDELSE BEGIN SET @output =Substring(@Note, @StartPos , @EndPos ) END RETURN @outputEND |
|
|
Kristen
Test
22859 Posts |
|
|
|
|
|