Sql Server 2005/2008备份/删除过期备份T
USE [master]
GO
/****** 对象: StoredProcedure [dbo].[sp_backupdatabase] 脚本日期: 07/15/2009 16:23:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[sp_backupdatabase]
@bak_path nvarchar(4000)='', --备份路径;
@baktype int = null, --备份类型0为全备,1为差异备,2为日志备份
@type int = null, --设置需要备份的库,0为全部库,1为系统库,2为全部用户库,3为指定库,4为排除指定库;
@dbnames nvarchar(4000)='', --需要备份或排除的数据库,用,隔开,当@type=3或4时生效
@overdueDay int = null, --设置过期天数,默认天;
@compression int =0 --是否采用sql2008的压缩备份,0为否,1为采用压缩
as
--sql server 2005/2008备份/删除过期备份T-sql 版本v1.0
/*
author:perfectaction
date :2009.04
desc :适用于sql2005/2008备份,自动生成库文件夹,可以自定义备份类型和备份库名等
可以自定义备份过期的天数
删除过期备份功能不会删除最后一次备份,哪怕已经过期
如果某库不再备份,那么也不会再删除之前过期的备份
如有错误请指正,谢谢.
*/
set nocount on
--开启xp_cmdshell支持
exec sp_configure 'show advanced options', 1
reconfigure with override
exec sp_configure 'xp_cmdshell', 1
reconfigure with override
exec sp_configure 'show advanced options', 0
reconfigure with override
print char(13)+'------------------------'
--判断是否填写路径
if isnull(@bak_path,'')=''
begin
 
相关文档:
bit:0或1的整型数字
int:从-2^31(-2,147,483,648)到2^31(2,147,483,647)的整型数字
smallint:从-2^15(-32,768)到2^15(32,767)的整型数字
tinyint:从0到255的整型数字
decimal:从-10^38到10^38-1的定精度与有效位数的数字
numeric:decimal的同义词
money:从-2^63(-922,337,203,685,477.580 ......
1,SqlServer存储过程的事务处理
一种比较通用的出错处理的模式大概如下:
Create procdure prInsertProducts
(
@intProductId int,
@chvProductName varchar(30),
@intProductCount int
)
AS
Declare @intErrorCode int
Select @intErrorCode=@@Error
Begin transaction
if @intError ......
========第一篇=========
在一张表中某个字段下面有重复记录,有很多方法,但是有一个方法,是比较高效的,如下语句:
select data_guid from adam_entity_datas a where a.rowid > (select min(b.rowid) from adam_entity_datas b where b.data_guid = a.data_guid)
如果表中有大量数据,但是重复数据比较少,那么 ......
C# SQL数据库操作通用类
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
namespace Framework.DataBase
{
///
/// 通用数据库类
///
public class DataBase
{
private string ConnStr = null;
public DataBase()
{
&nb ......