Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL Server 2000 ÖØÃüÃûÊý¾Ý¿â

ijÏîĿ֮ǰµÄÊý¾Ý¿âÓб仯£¬µ«ÊÇÒÔǰдµÄ³ÌÐòÊÇÖ§³ÖÀÏÊý¾Ý¿âµÄ£¬ÐÂÊý¾Ý¿âÓÐһЩÎÊÌ⣬ÐèÒªÐ޸ģ¬µ«ÊÇÊý¾Ý¿â¾ÍÖظ´ÁË£¬ÓÚÊǾÍÒª°Ñ¿ª·¢»úÉÏ֮ǰµÄÊý¾Ý¿âÖØÐÂÃüÃû¡£
ÕâÀï¼Ç¼һϲ½Ö裨¾ÉÃû³Æ£ºMobileMsg£¬ÐÂÃû³Æ£ºMobileMsg_old£©£º
1¡¢¹ØµôÆóÒµ¹ÜÀíÆ÷£¬´ò¿ª²éѯ·ÖÎöÆ÷£»
2¡¢ÐÞ¸ÄÊý¾Ý¿âÃû³Æ£º
EXEC sp_dboption 'MobileMsg', 'Single User', 'TRUE'
Go
EXEC sp_renamedb 'MobileMsg', 'MobileMsg_old'
Go
EXEC sp_dboption 'MobileMsg_old', 'Single User', 'FALSE'
Go
3¡¢ÐÞ¸ÄÐÞ¸ÄÊý¾Ý¿âµÄÂß¼­Ãû³Æ£º
alter database MobileMsg_old modify file(name='MobileMsg_Data', newname='MobileMsg_old_Data')
alter database MobileMsg_old modify file(name='MobileMsg_Log',  newname='MobileMsg_old_Log')
Go
4¡¢¹Ø±ÕSQL Server·þÎñ£¬ÐÞ¸ÄÎïÀíÃû³Æ£º
C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Data.MDF
C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Log.MDF
5¡¢ÖØÃüÃûÊý¾Ý¿âÎïÀíÎļþ£º
exec xp_cmdshell 'rename  C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_Data.MDF C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Data.MDF'
exec xp_cmdshell 'rename  C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_Log.LDF  C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Log.LDF'
go


Ïà¹ØÎĵµ£º

SQL SERVERÖÐһЩÌرðµØ·½µÄÌرð½â·¨

--1.¹ØÓÚwhereɸѡÆ÷ÖгöÏÖÖ¸¶¨ÐÇÆÚ¼¸µÄÇó½â
SQL code
--»·¾³
create table test_1
(
id int,
value varchar(10),
t_time datetime
)
insert test_1
select 1,'a','2009-04-19' union
select 2,'b','2009-04-20' union
select 3,'c','2009-04-21' union
select 4,'d','2009-04-22' union
s ......

SQL ÓÅ»¯¼¼ÇÉ

1 ±ÜÃâÎ޼ƻ®µÄÈ«±íɨÃè
  ÈçÏÂÇé¿ö½øÐÐÈ«±íɨÃ裺
-          ¸Ã±íÎÞË÷Òý
-          ¶Ô·µ»ØµÄÐÐÎÞÈ˺ÍÏÞÖÆÌõ¼þ£¨ÎÞWhere×Ӿ䣩
-          ¶ÔÓÚË÷ÒýÖ÷ÁУ¨Ë÷ÒýµÄµÚÒ» ......

SQL ʹÓà CONVERT

ʹÓà CONVERT£º
CONVERT (data_type[(length)], expression [, style])
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),\'-\',\'\'),\' \',\'\'),\':\',\'\')
20040912110608
select CONVERT(varchar(12) , getdate(), 111 ) ......

sql ·þÎñÆ÷½ÇÉ« Êý¾Ý¿â½ÇÉ«



sql ·þÎñÆ÷½ÇÉ« Êý¾Ý¿â½ÇÉ«
·þÎñÆ÷½ÇÉ«
ËùÓеķþÎñÆ÷½ÇÉ«¶¼ÊÇ“¹Ì¶¨µÄ”½ÇÉ«£¬²¢ÇÒ£¬´ÓÒ»¿ªÊ¼¾Í´æÔÚÓÚÄÇÀï——×Ô°²×°ÍêSQL ServerµÄÄÇÒ»¿ÌÆð£¬Ä㽫ӵÓеÄËùÓзþÎñÆ÷½ÇÉ«¾ÍÒѾ­´æÔÚÁË¡£

½Ç¡¡¡¡É«
ÌØ¡¡¡¡ÐÔ

sysadmin
¸Ã½ÇÉ«Äܹ»Ö´ÐÐSQL ServerÉϵÄÈκβÙ× ......

sql server ÈÕÖ¾ÎļþµÄÊÕËõ

ÍêÈ«±¸·Ý»òÈÕÖ¾±¸·ÝËä˵¶¼ÓнضÏÈÕÖ¾µÄ¹¦ÄÜ,µ«ÊDz»»áÊÕËõÈÕÖ¾ÎļþµÄ¿Õ¼ä·µ»Ø¸ø²Ù×÷ϵͳ.
Èç¹ûÄãÏ뽫ÈÕÖ¾ÎļþµÄ¿Õ¼ä·µ»Ø¸ø²Ù×÷ϵͳµÄ»°,Ö»ÓÐÒ»ÖÖ·½·¨,¾ÍÊÇÊÕËõÊý¾Ý¿â(Ñ¡ÔñÈÕÖ¾Îļþ)
ZTÒ»¸öÏà¹ØÌû×Ó,¹©²Î¿¼!
ÎïÀíÈÕÖ¾Îļþ£º
    Õâ¸ö±È½ÏºÃÀí½â£¬ÊµÊµÔÚÔڵĶ«Î÷£¬Êý¾Ý¿âĿ¼ÏÂÃæµÄ.ldfÎļþ¾ÍÊÇ£¬ÓÐЩÈËϲ»¶¸Äºó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ