Sql server存储过程中 数据集的缓存
create procedure DeleteWareHouse_StoreArea_SummaryByPUR
(@po_no nvarchar(100))
as
begin
declare @cacheTable table(wh_id int);--声明一个table类型的变量
insert @cacheTable select wh_id from aps_inventory_store_area where description=@po_no--向变量@cacheTable中添加结果集
--select * from @cacheTable
delete aps_inventory_summary where wh_id in(select * from @cacheTable)
delete aps_inventory_store_area where wh_id in(select * from @cacheTable)
delete aps_inventory_warehouse where wh_id in(select * from @cacheTable)
end
相关文档:
如果原来的数据库可用,分离数据库后,只附加数据文件,不附加日志
如果不可用,只能慢慢等还原操作完成了
日志文件太大了,应该定期整理日志
--压缩日志及数据库文件大小
&n ......
table a(id, type):
id type
----------------------------------
1 1
2 1
3 &n ......
向表中增加一个 varchar 列:
ALTER TABLE distributors ADD COLUMN address varchar(30);
从表中删除一个字段:
ALTER TABLE distributors DROP COLUMN address RESTRICT;
在一个操作中修改两个现有字段的类型:
ALTER TABLE distributors
ALTER COLUMN address TYPE varchar(80),
......
--当前使用的数据库是 系统自带的 master
create database temp1
go --此处不加go的话下面use temp1 会报错:找不到存储过程 'temp1'。
use temp1
set xact_abort on
begin tran
create table [order]( --order是关键字必须用[ ];
id int
)
create table fOrder(
id int
)
-- 下面的操作主要是为了实现fO ......
方法一:
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),\'-\',\'\'),\' \',\'\'),\':\',\'\')
20040912110608 h
select CONVERT(varchar(12) , getdate(), 111 )
2004/09/12
select CONVERT(varchar(12) , getdate(), 11 ......