SQLServerÊý¾Ý¿âÖÃÒÉ´¦Àí
SQL ServerÊý¾Ý¿â±¸·ÝÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇʹÓÃBACKUP DATABASE½«Êý¾Ý¿âÎļþ±¸·Ý³öÈ¥£¬ÁíÍâÒ»ÖÖ¾ÍÊÇÖ±½Ó¿½±´Êý¾Ý¿âÎļþmdfºÍÈÕÖ¾ÎļþldfµÄ·½Ê½¡£ÏÂÃ潫Ö÷ÒªÌÖÂÛһϺóÕߵı¸·ÝÓë»Ö¸´¡£±¾Îļٶ¨ÄúÄÜÊìÁ·Ê¹ÓÃSQL Server Enterprise Manager(SQL ServerÆóÒµ¹ÜÀíÆ÷)ºÍSQL Server Quwey Analyser(SQL Server²éѯ·ÖÎöÆ÷)
1¡¢Õý³£µÄ±¸·Ý¡¢SQLÊý¾Ý¿â»Ö¸´·½Ê½
Õý³£·½Ê½Ï£¬ÎÒÃÇÒª±¸·ÝÒ»¸öÊý¾Ý¿â£¬Ê×ÏÈÒªÏȽ«¸ÃÊý¾Ý¿â´ÓÔËÐеÄÊý¾Ý·þÎñÆ÷ÖжϿª£¬»òÕßÍ£µôÕû¸öÊý¾Ý¿â·þÎñÆ÷£¬È»ºó¸´ÖÆÎļþ¡£
жÏÂÊý¾Ý¿âµÄÃüÁSp_detach_db Êý¾Ý¿âÃû
Á¬½ÓÊý¾Ý¿âµÄÃüÁSp_attach_db»òÕßsp_attach_single_file_db
s_attach_db [@dbname =] ′dbname′, [@filename1 =] ′filename_n′ [,...16]
sp_attach_single_file_db [@dbname =] ′dbname′, [@physname =] ′physical_name′
ʹÓô˷½·¨¿ÉÒÔÕýÈ·»Ö¸´SQL Sever7.0ºÍSQL Server 2000µÄÊý¾Ý¿âÎļþ£¬ÒªµãÊDZ¸·ÝµÄʱºòÒ»¶¨Òª½«mdfºÍldfÁ½¸öÎļþ¶¼±¸·ÝÏÂÀ´£¬mdfÎļþÊÇÊý¾Ý¿âÊý¾ÝÎļþ£¬ldfÊÇÊý¾Ý¿âÈÕÖ¾Îļþ¡£
Àý×Ó£º
¼ÙÉèÊý¾Ý¿âΪtest£¬ÆäÊý¾ÝÎļþΪtest_data.mdf£¬ÈÕÖ¾ÎļþΪtest_log.ldf¡£ÏÂÃæÎÒÃÇÌÖÂÛÒ»ÏÂÈçºÎ±¸·Ý¡¢»Ö¸´¸ÃÊý¾Ý¿â¡£
жÏÂÊý¾Ý¿â£ºsp_detach_db 'test'
Á¬½ÓÊý¾Ý¿â£ºsp_attach_db 'test','C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_data.mdf','C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_log.ldf'
sp_attach_single_file_db 'test','C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_data.mdf'
2¡¢Ö»ÓÐmdfÎļþµÄ»Ö¸´¼¼Êõ
ÓÉÓÚÖÖÖÖÔÒò£¬ÎÒÃÇÈç¹ûµ±Ê±½ö½ö±¸·ÝÁËmdfÎļþ£¬ÄÇô»Ö¸´ÆðÀ´¾ÍÊÇÒ»¼þºÜÂé·³µÄÊÂÇéÁË¡££¨´ËÎÄÕÂÓÉ·É¿ÍÊý¾Ý»Ö¸´ÖÐÐÄËѼ¯http://www.cellma.com.cn£©
Èç¹ûÄúµÄmdfÎļþÊǵ±Ç°Êý¾Ý¿â²úÉúµÄ£¬ÄÇôºÜ½ÄÐÒ£¬Ò²ÐíÄãʹÓÃsp_attach_db»òÕßsp_attach_single_file_db¿ÉÒÔ»Ö¸´Êý¾Ý¿â£¬µ«ÊÇ»á³öÏÖÀàËÆÏÂÃæµÄÌáʾÐÅÏ¢
É豸¼¤»î´íÎó¡£ÎïÀíÎļþÃû 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test_Log.LDF' ¿ÉÄÜÓÐÎó¡£
ÒÑ´´½¨ÃûΪ 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_log.LDF' µÄÐÂÈÕÖ¾Îļþ¡£
µ«ÊÇ£¬Èç¹ûÄúµÄÊý¾Ý¿âÎļþÊÇ´ÓÆäËû¼ÆËã»úÉϸ´ÖƹýÀ´µÄ£¬ÄÇôºÜ²»ÐÒ£¬Ò²ÐíÉÏÊö°ì·¨¾ÍÐв»Í¨ÁË¡£ÄãÒ²Ðí»áµÃµ½ÀàËÆÏÂÃæµÄ´íÎóÐÅÏ¢
·þÎñÆ÷: ÏûÏ¢ 1813£¬¼¶±ð 16£¬×´Ì¬ 2
Ïà¹ØÎĵµ£º
ÎÒÔÚ°ÑoracleÊý¾Ýµ¼ÈësqlserverÖÐʱ£¬·¢ÏÖÔÚoracleÖÐ×ֶζ¨ÒåΪΨһË÷Òýʱ£¬²»Í¬¼Ç¼µÄ´Ë×Ö¶ÎÈç¹ûΪ¿Õ²»±»ÈÏΪÊÇÖظ´µÄ£¬µ«ÔÚsqlserverÖÐÈç¹û´Ë×Ö¶ÎΪΨһË÷Òý×ֶΣ¬²»ÔÊÐíÓÐ2¸öÒÔÉϵĿÕÖµ¡£ÓôÃÆ¡£ËùÒÔÖ»ºÃ½«sqlserverÖеÄΨһË÷Òý×Ö¶ÎÊÖ¹¤ÐÞ¸ÄΪ¼¸¸ö·Ç¿ÕµÄÖµ£¬µ«ÕâÑù³ÌÐò¿Ï¶¨Òª½øÐÐÐÞ¸ÄÁË¡£ÐèÒªÔÚ³ÌÐòÖÐΪ´Ë×Ö¶ÎÉèÖò»Öظ´ ......
ÈçºÎ²é¿´SQL SERVERÊý¾Ý¿âµ±Ç°Á¬½ÓÊý
1.ͨ¹ý¹ÜÀí¹¤¾ß
¿ªÊ¼->¹ÜÀí¹¤¾ß->ÐÔÄÜ£¨»òÕßÊÇÔËÐÐÀïÃæÊäÈë mmc£©È»ºóͨ¹ýÌí¼Ó¼ÆÊýÆ÷Ìí¼Ó SQL µÄ³£ÓÃͳ¼Æ È»ºóÔÚÏÂÃæÁгöµÄÏîÄ¿ÀïÃæÑ¡ÔñÓû§Á¬½Ó¾Í¿ÉÒÔʱʱ²éѯµ½Êý¾Ý¿âµÄÁ¬½ÓÊýÁË¡£²»¹ý´Ë·½·¨µÄ»°ÐèÒªÓзÃÎÊÄÇ̨¼ÆËã»úµÄȨÏÞ£¬¾ÍÊÇҪͨ¹ýWindowsÕË»§µÇ½½øÈ¥²Å¿ÉÒÔÌí¼Ó´Ë¼ÆÊ ......
create function comm_getpy
(
@str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
set @word=left(@str,1)
--Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ×Ö·û
& ......
declare @areaid varchar(100)
declare @areaname varchar(100)
declare Cur cursor for
select code as areaID,[name] as areaName from dbo.province
open Cur
Fetch next from Cur Into @areaid,@areaname
While @@fetch_status=0
Begin
print('insert into ......
SqlServerÃüÃû¹æ·¶
²Î¿¼¸÷ÖÖÃüÃû¹æ·¶£¬ÎÒÃÇͳһʹÓÃÃüÃû¹æ·¶ÈçÏ£º
ÃüÃû¹ý³ÌÖÐÈçÓÐÏÖ´æµÄËõд£¬ÔòʹÓøÃËõд£¬ÈçÎÞ£¬Ò»Âɲ»µÃËõд£¬Àý£ºISBN
Êý¾Ý¿â£ºÓÃÒ»¸ö»òÈý¸öÒÔÏÂÓ¢Îĵ¥´Ê×é³É£¬µ¥´ÊÊ××Öĸ´óд£¬È磺DepartmentManage£»
±íÃû£ºÊ¹ÓÃÃû´ÊÐÔÖʵĵ¥´ÊÈ«Æ´±íʾ£¬¸÷µ¥´ÊÊ××Öĸ´óд£¬ ʹÓø´ÊýÐÎʽ£¬È磺Books
& ......