当然有了,若建临时表,必须在表前设置#(局部临时表)或##(全局临时表),注意临时表是创建在tempdb数据库上.例子如下:
例: 1.创建临时表,直接通过create table命令,如下:
create table #title
(
title longstring not null,
author normstring not null,
synopsis text null
)
2.在查询的基础上建表(往往在存储过程或触发器中使用临时表)
....
Select title=substring(title,1,40),
monthly=YTD_SALES/12
into #PHONYTABLE
from TITLES
...
....当你在自己的存储过程中使用表时,一般用局部临时表,其他存储过程不能访问,用完之后,调用删除表的命令去删除!!!!
例: 1.创建临时表,直接通过create table命令,如下:
create table #title
(
title longstring not null,
author normstring not null,
synopsis text null
)
2.在查询的基础上建表(往往在存储过程或触发器中使用临时表)
....
Select title=substring(title,1,40),
monthly=YTD_SALES/12
into #PHONYTABLE
from TITLES
...
....当你在自己的存储过程中使用表时,一般用局部临时表,其他存储过程不能访问,用完之后,调用删除表的命令去删除!!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货