Whether the SQL query field contains the specific character code

Source: Internet
Author: User

Update Survey_QuestionColumns set ColumnPath = '1 | 3 | 1000 | 6 'where ColumnPath = '1 | 3 | 4 | 6'

Create function Spliaaaa
(
@ List nvarchar (2000), -- string to be separated
@ SplitOn nvarchar (5), -- delimiter
@ Num int
)
RETURNS varchar (50)
As
BEGIN
Declare @ aaa varchar (50)
Declare @ RtnValue table
(
Id int identity (1, 1 ),
[Value] nvarchar (100)
)
While (Charindex (@ SplitOn, @ List)> 0)
Begin
Insert Into @ RtnValue ([Value])
Select
[Value] = ltrim (rtrim (Substring (@ List, 1, Charindex (@ SplitOn, @ List)-1 )))
Set @ List = Substring (@ List, Charindex (@ SplitOn, @ List) + len (@ SplitOn), len (@ List ))
End
Insert Into @ RtnValue ([Value])
Select [Value] = ltrim (rtrim (@ List ))
Select @ aaa = [Value] from @ RtnValue where Id = @ num-1
Return @ aaa
END
Go
Select * from Survey_QuestionColumns where dbo. Spliaaaa (ColumnPath, '|', 3) = '3'

Drop function Spliaaaa

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.