insert #array
select 'CChess'as str union all
select 'Dig'as str union all
select 'GoBang'as str union all
select 'LandLord'as str union all
select 'Majiang'
create proc [dbo].[CreateArray]
@string varchar(1024)
as
create table #array (id int identity,value varchar(32))
set @string='insert #array select '''+
replace(@string,',','''as str union all select ''')+''''
select @string
exec(@string)
select * from #array
insert #array select 'CChess'
as str union all select 'Dig'
as str union all select 'GoBang'
as str union all select 'LandLord'
as str union all select 'Majiang'
go drop procedure [dbo].[CreateArray]
exec CreateArray 'CChess,Dig,GoBang,LandLord,Majiang'
create table #array2 (id int identity,value varchar(32))
insert #array2 select 'CChess'
select * from #array2
create table newtable
(
姓名 nchar(20),
公司 nchar(50)
)
insert newtable select lastName,country
from Employees
select * from newtable
drop table newtable