本文介绍了Sql server USP在单元格中查找列文本,并在相应的单元格中插入true或false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编写USP来搜索字符串,该字符串是另一列的单元格中的列名,如果搜索关键字在Searched列中可用,那么对于相应的行,它应插入1(true),如果不是那么0(假)。
让我详细说明:
我的桌子(SearchableTable):
Hi, I'm trying to write a USP to search a string which is a column name in another column's cell and if the search keyword is available in the Searched column then for the respective row it should insert 1 (true) , if not then 0 (false).
Let me elaborate it:
My table (SearchableTable):
ID ArticleColumn Installed Proactive process
234 That was installed on client machine. 1 0 0
235 Preparation for all above 0 0 0
236 A proactive process of installation. 0 1 1
237 the process in a different way. 0 0 1
逻辑:
The logic:
ALTER PROCEDURE [dbo].[SerachColumn]
AS
BEGIN
-- GET the 1st searchable column name
-- Search it in the 'ArticleColumn' column
-- if found insert 1 in the respective cell or 0
-- Do this for rest of the columns
-- when the columns finish come to the next row
-- and search the 1st column name again in the respective 2nd row of the 'ArticleColumn'
-- repeat the process till all the searchable columns and rows finish.
END
请帮助。
Please help.
推荐答案
这篇关于Sql server USP在单元格中查找列文本,并在相应的单元格中插入true或false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!