How to truncate string using SQL server

后端 未结 6 883
一整个雨季
一整个雨季 2020-12-08 01:43

i have large string in SQL Server. I want to truncate that string to 10 or 15 character

Original string

this is test string. this is test string. thi         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 02:27

    You can also use the Cast() operation :

     Declare @name varchar(100);
    set @name='....';
    Select Cast(@name as varchar(10)) as new_name
    

提交回复
热议问题