Number of times a particular character appears in a string

后端 未结 10 2410
终归单人心
终归单人心 2020-11-27 16:41

Is there MS SQL Server function that counts the number of times a particular character appears in a string?

10条回答
  •  暖寄归人
    2020-11-27 16:44

    BEST

    DECLARE @yourSpecialMark = '/';
    select len(@yourString) - len(replace(@yourString,@yourSpecialMark,''))
    

    It will count, how many times occours the special mark '/'

提交回复
热议问题