ITeye博客

Sybase:select ...into/insert...select

Ashton · 2007-06-12 23:39 · DB · Markdown

在使用数据库的时候,有时我们需要把一个表中的数据经过筛选插入另外一个表中。Sybase提供一种特殊的方式来实现这一功能,例如
insert into boy
select id,name
from person
where type='boy'
通过insert .... select ...语句,select的结果会被直接插入表boy中,并且每个插入操作都会被记录到事务日志之中

Sybase还提供了一种"select ... into"语句实现类似功能
例如,
select  id,name
from person
where type='boy'
into boy
这时一个拥有字段id和name的表boy会被自动创建,select的结果会被直接插入新建的表中,但操作并不会被记录到事务日志,并且select..into只有在事务日志trun off 之后方可使用

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。