34,594
社区成员
发帖
与我相关
我的任务
分享
create table employee(id int,name varchar(10))
insert into employee
select 1,'a'
go
create table E_CRlation(EName varchar(10),CName varchar(10))
insert into E_CRlation
select 'employee','员工表'
go
declare @sql varchar(1000)
declare @tbname varchar(10)
set @tbname = 'employee'
select @sql = isnull(@sql,'')+' select * into [' + CName + '] from ' + @tbname
from E_CRlation
where EName = @tbname
print @sql
exec(@sql)
go
select *
from [员工表]
drop table employee,E_CRlation,[员工表]
/**************
select * into [员工表] from employee
(1 行受影响)
id name
----------- ----------
1 a
(1 行受影响)
into #表2
string CreateStr =" select tihao,tixing,xiaolei,timu into [表2] from ti where xiaolei='第一章'";
OleDbCommand cmd5 = new OleDbCommand(CreateStr,conn);
cmd5.ExecuteNonQuery();