SQL Server2005 Ô¶³Ì·ÃÎÊÅäÖÃ
´ÓÍøÂçÉÏ¿´µ½²»ÉÙ¹ØÓÚÊý¾Ý¿âÔ¶³Ì·ÃÎÊÅäÖõÄÎÄÕ£¬¸øÎҵĴóÌåÓ¡Ïó¾ÍÊÇÅäÖùý³Ì¸´ÔÓÈßÓ࣬Óв»ÉÙ»¹ÊÇ´íÎóµÄÅäÖÆ·½·¨£¬´ó¶àÊý¶¼ÈÃÈ˸оõ·Ñ½â£¬¼øÓÚ´Ë£¬ÎÒ×Ô¼º¸ù¾Ýʵ¼Ê²Ù×÷£¬Ð´ÁËÒ»¸öÊý¾Ý¿âÔ¶³Ì·ÃÎʵÄÅäÖ÷½·¨£¬Á¦Çó¼òµ¥ÓÐЧ¡£ÓжÔÏÂÃæÅäÖÃÓÐÒÉÎʵĿÉÒÔÁôÑÔ£¬ÎÒ½«×÷³ö»Ø´ð¡£
1. ÔÚ“¼ÆËã»ú¹ÜÀí”ÀïÃæÕÒµ½“SQL Server 2005 ÅäÖùÜÀíÆ÷”ϵēSQL Server 2005 ÍøÂçÅäÖÔ£¬È»ºóÔÚSQLEXPRESSµÄÐÒéÀïÃæÆôÓÓTCP/IP”ÐÒ飬²¢ÖØÐÂÆô¶¯SQL Server 2005 ·þÎñ¡£
2. ÓÒ¼üµã»÷“TCP/IP”ÐÒéÑ¡Ôñ“ÊôÐÔ”½øÈëÊôÐÔ¶Ô»°¿ò£¬È»ºóÑ¡Ôñ“IP µØÖ·”Ñ¡Ïî¡£
3. ÔÚ“IPALL”ÀïÃæÉ趨“TCP ¶¯Ì¬¶Ë¿Ú”Ϊ1433 ¡£µã»÷“È·¶¨”Í˳ö£¬Ê¹Óñ¾»úIPµØÖ·¾Í¿ÉÒԵǽÊý¾Ý¿â·þÎñÁË¡£
²¹³ä£ºÕâÑùÉèÖÃÍê³ÉºóÆäËû»úÆ÷¾Í¿ÉÒÔͨ¹ý±¾»úµÄIPµØÖ·½øÐÐÊý¾Ý¿âµÄ·ÃÎÊÁË£¬Èç¹û»¹Á¬½Ó²»ÉÏÒ»°ã¾ÍÊDZ¾»ú·À»ðǽµÄÎÊÌ⣬½ûÓ÷À»ðǽ»òÉèÖÃÀýÍâ¾Í¿ÉÒÔ½â¾öÕâ¸öÎÊÌâÁË¡£
Ïà¹ØÎĵµ£º
declare @ID varchar(10)
set @ID=9 --¸ù½Úµã
declare @i int --¼¶Êý
declare @t table(ID varchar(10),ParentID varchar(10),Level int)
set @i = 1
insert into @t select @ID,0,0 --µ±Ç°¼¶£¬±¾¼¶£¬Èç¹û²»ÒªµÄ»°¿ÉÒÔ×¢Ê͵ô»òÔÙ¼Ó¸ö²ÎÊýÀ´Ñ¡Ôñ²Ù×÷
insert into @t select ID,ParentID,@i from t_ ......
¡¡2005²»ÂÛÊÇÐÔÄÜ»¹ÊÇ°²È«ÐÔ¶¼ÊÇSQL SERVER2000ÓÐËùÔöÇ¿£¬ÏÖÓв»ÉÙÆóÒµÔÚʹÓÃ2005£¬»òÊÇÓеÄÓû§ÊÇ2000Óë2005ͬʱʹÓã¬ÄÇôÕâÖмä¾ÍÉæ¼°µ½Ë«Êý¾ÝµÄת»»ÎÊÌ⣺
¡¡¡¡½ñÌìÎÒÃǾÍÀ´¿´Ò»ÏÂÏà¹ØµÄʵÏÖ·½·¨£º
¡¡¡¡±¾È˵ÄʵÏÖ»·¾³½éÉÜ£º
¡¡¡¡·½·¨Ò»£º ʹÓ÷ÖÀëÓ븽¼Ó¡¡ ¸Ã·½·¨ÊʺÏÓÚ½«SQL Server 2000ÖеÄÊý¾Ýת»»µ½SQL Server2 ......
¸ù據ǰһƪ關ì¶×Ô動備·ÝµÄÎÄÕ£¬對應µÄ×Ô動還Ô·½°¸
create procedure [dbo].[sp_RestoreDatabase]
@SourceDirBackupFiles NVARCHAR(200)
as
declare @DatabaseName sysname
--Table to hold the result from RESTORE HEADERONLY. Needed to get the database name o ......
µ±ÔÚÄÚÁ¬½Ó²éѯÖмÓÈëÌõ¼þʱ£¬ÎÞÂÛÊǽ«Ëü¼ÓÈëµ½join×Ӿ䣬»¹ÊǼÓÈëµ½where×Ӿ䣬ÆäЧ¹ûÊÇÍêÈ«Ò»ÑùµÄ£¬µ«¶ÔÓÚÍâÁ¬½ÓÇé¿ö¾Í²»Í¬ÁË¡£µ±°ÑÌõ¼þ¼ÓÈëµ½ join×Ó¾äʱ£¬»á·µ»ØÍâÁ¬½Ó±íµÄÈ«²¿ÐУ¬È»ºóʹÓÃÖ¸¶¨µÄÌõ¼þ·µ»ØµÚ¶þ¸ö±íµÄÐС£Èç¹û½«Ìõ¼þ·Åµ½where×Ó¾äÖУ¬½«»áÊ×ÏȽøÐÐÁ¬½Ó²Ù×÷£¬È»ºóʹÓÃwhere×Ó¾ä¶ÔÁ¬½ÓºóµÄÐнøÐÐɸѡ¡ ......
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname ......