本文介绍了如果可能的话,是否可以向单个列插入多个值,然后我希望按其任何值搜索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于ex表,adc分别包含3列,如col1,col2,col3(col3,它具有多个值,如ab,cd,ef)
i只想搜索记录,如select * from abc where col3 =''cd''
For ex the table adc contains 3 column like col1, col2, col3 respectively (col3 which having multiple value like ab, cd, ef)
i just want o search the record like "select * from abc where col3 = ''cd''"
推荐答案
CREATE TABLE [instance].[schema].[oneliner](
[boxcarred][nvarchar](MAX)
)
CREATE TABLE [instance].[schema].[onelinerIdx](
[idx][int]IDENTITY(1,1),
[boxcarred][nvarchar](MAX)
)
BULK INSERT [instance].[schema].[oneliner] FROM ''C:\users\clrue\MFLL.txt''
WITH (
CODEPAGE = ''ACP''
)
INSERT INTO [instance].[schema].[onelinerIdx]
SELECT [boxcarred] FROM [instance].[schema].[oneliner]
一旦进入表格,数据就是一行或多行,对吗?
现在创建一个表,并通过REPLACE过滤最后索引的单个/多个...
Once in the table, the data is either one line or multiple lines, right?
Now create one more table, and filter that last indexed single/multi through a REPLACE ...
CREATE TABLE [instance].[schema].[nohammer](
[idx][int],
[seetosearch][nvarchar](MAX)
)
INSERT INTO [instance].[schema].[nohammer]
SELECT [idx], REPLACE([seetosearch],CHAR(13)+CHAR(10),'' '') FROM [instance].[schema].[onelinerIdx]
Now搜索这个目标字符串usg无论如何。得到它?现在不是表,只是一个字符串......
Now search this target "string" usg whatever. Get it? Not a table now, just a string ...
这篇关于如果可能的话,是否可以向单个列插入多个值,然后我希望按其任何值搜索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!