select top 8000 identity(int,1,1) id into #dali from sysobjects a,sysobjects b
declare @dali table (a int,b varchar(100))insert @dali values (1,'我们,祖国,开门,他们')
insert @dali values (2,'字段,使得')
insert @dali values (3,'考虑,挨饿,设狼,网络')
select a,substring(','+b,id+1,charindex(',',','+b+',',id+1)-id-1)
from @dali aa,#dali bb
where substring(','+b,id,8000) like ',_%'
order by a,id
drop table #dali
declare @dali table (a int,b varchar(100))insert @dali values (1,'我们,祖国,开门,他们')
insert @dali values (2,'字段,使得')
insert @dali values (3,'考虑,挨饿,设狼,网络')
select a,substring(','+b,id+1,charindex(',',','+b+',',id+1)-id-1)
from @dali aa,#dali bb
where substring(','+b,id,8000) like ',_%'
order by a,id
drop table #dali
dim test1,test2,test3
dim arraytwo(10,2)
test1=request.form("行一“)
test2=split(test1,",")
给数组付直
根据数组下标判断即可
SELECT au_lname, SUBSTRING(au_fname, 1, 1)
FROM authors
ORDER BY au_lname下面是结果集:au_lname
---------------------------------------- -
Bennet A
Blotchet-Halls R
Carson C
DeFrance M
del Castillo I
...
Yokomoto A (23 row(s) affected)下例显示如何显示字符串常量 abcdef 中的第二个、第三个和第四个字符。SELECT x = SUBSTRING('abcdef', 2, 3)下面是结果集:x
----------
bcd(1 row(s) affected)
牛!
学习!!!
declare @temp varchar(100)
declare @iTemp intdeclare getcursor cursor for
select keywords from table
open getcursor
fetch next from getcursor into @strTemp
while @@fetch_status <> -1
begin
if @@fetch_status = -2
begin
fetch next from getcursor into @strTemp
continue
end
while 1=1
begin
select @iTemp = charindex(',', @strTemp)
if @iTemp = 0
begin
select @temp = left(@strTemp, len(@strTemp))
end
else
begin
select @temp = left(@strTemp, @iTemp)
select @strTemp = right(@strTemp, len(@strTemp)-@iTemp)
end
print @temp
if @iTemp = 0
break
end
fetch next from getcursor into @strTemp
end
close getcursor
deallocate getcursor