模糊匹配最好用遊標 不過就是速度有點慢
declare test_cursor cursor scroll for --宣告遊標test_cursor
select name from test --將test表中的name欄位放入遊標變數@name中
open test_cursor
declare @name varchar(10)
while @@fetch_status=0
begin
fetch next from test_cursor into @name
select * from table where table.name like "%"+@name+"%"
--@name與table表中的name比較
end
close test_cursor
deallocate test_cursor
模糊匹配最好用遊標 不過就是速度有點慢
declare test_cursor cursor scroll for --宣告遊標test_cursor
select name from test --將test表中的name欄位放入遊標變數@name中
open test_cursor
declare @name varchar(10)
while @@fetch_status=0
begin
fetch next from test_cursor into @name
select * from table where table.name like "%"+@name+"%"
--@name與table表中的name比較
end
close test_cursor
deallocate test_cursor