如何用 Insert Into 生成一个新表,如果表不存在,就自动创建它,如何做?

fox1999 2006-09-30 09:18:13
如何用 Insert Into 生成一个新表,如果表不存在,就自动创建它,如何做?
...全文
2514 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyq_123 2006-10-02
  • 打赏
  • 举报
回复
if(表存在)
begin
insert 表名 select ...
end
else
begin
create table 表名
insert 表名 select ...
endg
wisdomone 2006-10-02
  • 打赏
  • 举报
回复
if exists
(select table_name from information_schema where table_name='tabname')---判断表是否存在
drop table tabname
else
begin
create table tabname
insert tabname
select [被导入的表]
where condition
end


windbey 2006-10-01
  • 打赏
  • 举报
回复
if(表存在)
begin
insert 表名 select ...
end
else
begin
create table 表名
insert 表名 select ...
endg
fox1999 2006-09-30
  • 打赏
  • 举报
回复
MD. 我用的 FireBird 不支持 Select into
xyxfly 2006-09-30
  • 打赏
  • 举报
回复
Insert Into 生成一个新表

不行,要用select Into
allright_flash 2006-09-30
  • 打赏
  • 举报
回复
select * into newTableName from oldTableName
点点星灯 2006-09-30
  • 打赏
  • 举报
回复
--如果接受数据导入的表已经存在
insert into 表 select * from tablename


--如果导入数据并生成表
select * into 表 from tablename
小辉 2006-09-30
  • 打赏
  • 举报
回复
select * into newTableNaem
from
(
select 1 , '01'
union select 2 , '02'
union select 3 , '03'
union select 4 , '01'
union select 5 , '02'
union select 6 , '03'
union select 7 , '01'
union select 8 , '02'
union select 9 , '04'
union select 10 , '05'
)
小辉 2006-09-30
  • 打赏
  • 举报
回复
select * into newTableName from oldTableName where .....

34,837

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧