What is the MS SQL Server capability similar to the MySQL FIELD() function?

前端 未结 4 1639
不知归路
不知归路 2020-12-09 17:44

MySQL provides a string function named FIELD() which accepts a variable number of arguments. The return value is the location of the first argument in the list of the remai

4条回答
  •  不知归路
    2020-12-09 18:26

    ORDER BY CHARINDEX(','+convert(varchar,status)+',' ,   
      ',rejected,active,submitted,approved,')
    
    
    just put a comma before and after a string in which you are finding the substring index or you can say that second parameter.
    
    and first parameter of charindex is also surrounded by ,  
    

提交回复
热议问题