if exists(select 1 from sysobjects where name='f_cut')
  drop function f_cut
go

CREATE FUNCTION f_cut
(
@s NVARCHAR(50),--你要截取的字符串
@i INT--截取的长度
)
RETURNS NVARCHAR(50)
AS
BEGIN
DECLARE @j INT
DECLARE @a NVARCHAR(100) 
SET @j=1
WHILE @j<=@i
  BEGIN
   IF UNICODE(SUBSTRING(@s,@j,1)) BETWEEN 19968 AND 40868
    BEGIN 
     SET @i=@i-1
     
    END
     SET @j=@j+1
  END 
RETURN LEFT(@s,@i)
END
GO
