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±¸·Ý£¬×Ô¶¯Éú³É¿âÎļþ¼Ð£¬¿ÉÒÔ×Ô¶¨Ò屸·ÝÀàÐͺͱ¸·Ý¿âÃûµÈ
¿ÉÒÔ×Ô¶¨Ò屸·Ý¹ýÆÚµÄÌìÊý
ɾ³ý¹ýÆÚ±¸·Ý¹¦Äܲ»»áɾ³ý×îºóÒ»´Î±¸·Ý£¬ÄÄÅÂÒѾ¹ýÆÚ
Èç¹ûij¿â²»ÔÙ±¸·Ý£¬ÄÇôҲ²»»áÔÙɾ³ý֮ǰ¹ýÆڵı¸·Ý
ÈçÓдíÎóÇëÖ¸Õý£¬Ð»Ð».
*/
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
 
Ïà¹ØÎĵµ£º
ÔÚÎÒÃǵÄÈÕ³£±à³ÌÖУ¬Êý¾Ý¿âµÄ³ÌÐò»ù±¾É϶¼ÒªÓëSQLÓï¾ä´ò½»µÀ£¬SQLÓï¾äµÄ±àд²»¿É±ÜÃâµÄ³ÉΪһ¸öÍ·Ì۵Ť×÷¡£ÇÒÒòΪSQLÓï¾äÊÇSTRINGÀàÐÍ£¬Òò´ËÔÚ±àÒë½×¶Î²é²»³ö´í£¬Ö»Óе½ÔËÐÐʱ²ÅÄÜ·¢ÏÖ´íÎó¡£
±¾ÎĵĽâ¾ö·½°¸£¬Í¨¹ý×Ô¶¯Éú³ÉSQLÓï¾ä£¬ÔÚÒ»¶¨³Ì¶ÈÉϽµµÍ³ö´íµÄ¸ÅÂÊ£¬´Ó¶øÌá¸ß±à³ÌЧÂÊ¡£ public int ......
Ç°¶Îʱ¼ä×öÁËÒ»¸öÐéÄâ×éÖ¯µÄ´´½¨¡£Õâ¸öÐéÄâ×éÖ¯µÄ´´½¨ÊÇ´ÓÏÖÓеÄ×éÖ¯ÖжÁÈ¡Êý¾ÝÈ»ºó½øÐзÖÎö±£´æµ½ÐéÄâ×éÖ¯±íÖС£±£´æÖ®ºóдÈÕÖ¾·½±ãͬ²½µ½ÆäËüϵͳÖС£¹«Ë¾Ê¹ÓõÄÖ÷Òª¼¼ÊõÊÇSSH¡£ÓÉÓÚÊÇÐÂÈËûÓÐʲô¾Ñ飬¼Ó֮ʱ¼ä±È½Ï½ôÆÈ£¬×îºóʹÓÃÒ»°ãµÄÂ߼˼Ïëͨ¹ýµÝ¹éÔÚhibernateÏÂ˳Àû´´½¨ÁË¡£¿ÉÊÇ´ÓÏÖÓеÄ×éÖ¯Ö ......
asc °´ÉýÐòÅÅÁÐ
desc °´½µÐòÅÅÁÐ
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(Create£¬Alter£¬Drop£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(Select£¬Delete£¬Update£¬Insert)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´ ......
ÍâÁ¬½ÓÈ¡Êý¾ÝÈç¹ûΪ¿Õ£¬²»´æÔÚASʱ¿ÉÄÜÈ¡µ½Êý¾Ý£¬µ«¼ÓÁËAS¾Í»á±¨´í¡£±ÈÈçSelect Top 10 a.*,b.Class AS ClassId
,b.DeviceName from AuxBusInfo a Left Join DeviceCandidate b On a.InitialDeviceRscId = b.DeviceRscId Order By AuxBusId£¬µ± ......