declare @chliveaddress nvarchar(4000)
set @chliveaddress='张江;闵行;浦东;金桥;'
--分割开的字符串
create table #chliveaddress(
address varchar(100)
)
/*字符串分割*/
while(charindex(';', @chliveaddress) <> 0)
begin
insert into #chliveaddress(address)
values((substring(@chliveaddress, 1, charindex(';', @chliveaddress) - 1 ))
)
set @chliveaddress = stuff(@chliveaddress, 1, charindex(';',@chliveaddress), '')
-- insert into #chliveaddress( address )values( @chliveaddress)
end
select * from #chliveaddress
drop table #chliveaddress
set @chliveaddress='张江;闵行;浦东;金桥;'
--分割开的字符串
create table #chliveaddress(
address varchar(100)
)
/*字符串分割*/
while(charindex(';', @chliveaddress) <> 0)
begin
insert into #chliveaddress(address)
values((substring(@chliveaddress, 1, charindex(';', @chliveaddress) - 1 ))
)
set @chliveaddress = stuff(@chliveaddress, 1, charindex(';',@chliveaddress), '')
-- insert into #chliveaddress( address )values( @chliveaddress)
end
select * from #chliveaddress
drop table #chliveaddress