社区
MS-SQL Server
帖子详情
如何用 Insert Into 生成一个新表,如果表不存在,就自动创建它,如何做?
fox1999
2006-09-30 09:18:13
如何用 Insert Into 生成一个新表,如果表不存在,就自动创建它,如何做?
...全文
2514
9
打赏
收藏
如何用 Insert Into 生成一个新表,如果表不存在,就自动创建它,如何做?
如何用 Insert Into 生成一个新表,如果表不存在,就自动创建它,如何做?
复制链接
扫一扫
分享
转发到动态
举报
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 .....
select into from 与
insert
into select用法详解
select into from 和
insert
into ...select into from 要求目标
表
不存在
,因为在插入时会
自动
创建
。
insert
into select from 要求目标
表
已存在数据库中。 一、
INSERT
INTO SELECT语句 1、语句形式为:
insert
多条记录,且
自动
创建
表
操作
Insert
可以使
一个
表
新增
一个
或多个记录的用法: [/quote] [code="sql"]
INSERT
INTO:新增
一个
记录。
INSERT
INTO…SELECT:新增多个记录。 一、
INSERT
INTO 新增
一个
记录的
INSERT
INTO...
新增
表
记录(
insert
into)
insert
into userinfo(userid,username,email)--插入一行数据,要一一对应 values('genve','张三','genve@qq.com'); select * from [dbo].[userinfo];
insert
into userinfo(userid,username,...
mysql
insert
时
自动
生成
id
实现“mysql
insert
时
自动
生成
id”流程 整体流程 下面是实现“mysql
insert
时
自动
生成
id”的整体流程: 步骤 操作 ...
创建
表
时定义自增长主键 ...首先,在
创建
表
的时候,需要定义
一个
自增长的主键。这...
mysql select into和
insert
into select
SELECT INTO FROM语句 语句形式为:SELECT ... 要求目标
表
Table2
不存在
,因为在插入时会
自动
创建
表
Table2,并将Table1中指定字段数据复制到Table2中 2、
INSERT
INTO SELECT语句 语句形式为:
Insert
into
MS-SQL Server
34,837
社区成员
254,634
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章