SQL Server 2005ÖÐʵÏÖ×Ô¶¯±¸·Ý
ÔÚSQL Server 2005Êý¾Ý¿âÖÐʵÏÖ×Ô¶¯±¸·ÝµÄ¾ßÌå²½Öè:
1¡¢´ò¿ªSQL Server Management Studio
2¡¢Æô¶¯SQL Server´úÀí
3¡¢µã»÷×÷Òµ->н¨×÷Òµ
4¡¢"³£¹æ"ÖÐÊäÈë×÷ÒµµÄÃû³Æ
5¡¢Ð½¨²½Ö裬ÀàÐÍÑ¡T-SQL£¬ÔÚÏÂÃæµÄÃüÁîÖÐÊäÈëÏÂÃæÓï¾ä£¨ºìÉ«²¿·ÖÒª¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿ö¸ü¸Ä£¬D:sql2005back¸ÄΪ×Ô¼ºµÄ±¸·Ý·¾¶£¬sq_testÐÞ¸ÄΪÏ뱸·ÝµÄÊý¾Ý¿âµÄÃû³Æ£©
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ’:’ , ’.’)
set @strPath = ’D:sql2005back’ + @strPath + ’.bak’
BACKUP DATABASE [sq_test] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
6¡¢Ìí¼Ó¼Æ»®£¬ÉèÖÃƵÂÊ£¬Ê±¼äµÈ¡£
Ïà¹ØÎĵµ£º
CUBE ºÍ ROLLUP Ö®¼äµÄÇø±ðÔÚÓÚ£º
CUBE Éú³ÉµÄ½á¹û¼¯ÏÔʾÁËËùÑ¡ÁÐÖÐÖµµÄËùÓÐ×éºÏµÄ¾ÛºÏ¡£
ROLLUP Éú³ÉµÄ½á¹û¼¯ÏÔʾÁËËùÑ¡ÁÐÖÐÖµµÄijһ²ã´Î½á¹¹µÄ¾ÛºÏ¡£
Àý×Ó£º
if object_id('a') is not null
drop table a
create table a
(
bm varchar(20), --±àÂë
ck varchar(2), &n ......
DATEDIFF(²ÎÊýÒ»,²ÎÊý¶þ,²ÎÊýÈý) ---²ÎÊýÒ»£ºyear month day; ²ÎÊý¶þ£º±È½ÏµÄÆðʼÈÕÆÚ,ĬÈÏ1900-1-1£»²ÎÊýÈý£º±È½ÏµÄÈÕÆÚ¡£
eg:DATEDIFF(year,0,getdate())±íʾ±È½Ï0£¨Ä¬ÈÏ1900-1-1£©µ½µ±Ç°µÄÈÕÆÚÏë²î¼¸Äê
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) -- È¡µÃ±¾ÔµĵÚÒ»Ìì
SELECT DATEADD(wk, D ......
Ö£ÖØÉùÃ÷һϣ¬ÕâƪÈÕÖ¾ÊÇÎÒCopyµÄ£¬²»ÊÇ×Ô¼ºÐ´µÄ£¬ÎÒ»¹Ã»ÄÇôǿ£¡(×Ðϸ¿´Ò»Ï£¬ÓÐÓá£)
¹ØÓÚSQLÓï¾äÖеÄË«ÒýºÅ¡¢µ¥ÒýºÅ£º
£¨1£©ÏÈÀ´¿´Ò»¸ö×î¼òµ¥µÄSQLÓï¾ä
Insert Into users(username) values("СÍõ")
´ó¼ÒÀ´¿ ......
ÔÚSQL*PlusÖÐĬÈϵÄ"&"±íʾÌæ´ú±äÁ¿£¬SQL*PlusÈÏΪ&·ûºóÃæµÄ×Ö·û´®Îª±äÁ¿£»Ö»ÒªÔÚÃüÁîÖгöÏָ÷ûºÅ£¬SQL*Plus¾Í»áÒªÄãÊäÈëÌæ´úÖµ¡£Õâ¾ÍÒâζ×ÅÄãÎÞ·¨½«Ò»¸öº¬Óи÷ûºÅµÄ×Ö·û´®²åÈë»ò¸üе½Êý¾Ý¿â
set define off ¹Ø±ÕÌæ´ú±äÁ¿¹¦ÄÜ£¬“&”½«×÷ΪÆÕͨ×Ö·û
set def ......