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

sql±¸·ÝÊý¾Ý¿âÓï¾ä:SQL±¸·ÝÓï¾ä

--ÍêÕû±¸·Ý
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Full_20070908.bak'
--²îÒ챸·Ý
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Df_20070908.bak'
With Dferential
--ÈÕÖ¾±¸·ÝĬÈϽضÏÈÕÖ¾
Backup Log NorthwindCS
To disk='G:\Backup\NorthwindCS_Log_20070908.bak'
--ÈÕÖ¾±¸·Ý²»½Ø¶ÏÈÕÖ¾
Backup Log NorthwindCS
To disk='G:\Backup\NorthwindCS_Log_20070908.bak'
With No_Truncate
--½Ø¶ÏÈÕÖ¾²»±£Áô
Backup Log NorthwindCS
With No_Log
--»òÕß
Backup Log NorthwindCS
With Truncate_Only
--½Ø¶ÏÖ®ºóÈÕÖ¾Îļþ²»»á±äС
--ÓбØÒª¿ÉÒÔ½øÐÐÊÕËõ
--Îļþ±¸·Ý
Exec Sp_Helpdb NorthwindCS --²é¿´Êý¾ÝÎļþ
Backup Database NorthwindCS
File='NorthwindCS' --Êý¾ÝÎļþÂß¼­Ãû
To disk='G:\Backup\NorthwindCS_File_20070908.bak'
--Îļþ×鱸·Ý
Exec Sp_Helpdb NorthwindCS --²é¿´Êý¾ÝÎļþ
Backup Database NorthwindCS
FileGroup='Primary' --Êý¾ÝÎļþÂß¼­Ãû
To disk='G:\Backup\NorthwindCS_FileGroup_20070908.bak'
With init
--·Ö¸î±¸·Ýµ½¶à¸öÄ¿±ê
--»Ö¸´Ê±ºò²»ÔÊÐí¶ªÊ§ÈκθöÄ¿±ê
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Full_1.bak'
,disk='G:\Backup\NorthwindCS_Full_2.bak'
--¾µÏñ±¸·Ý
--ÿ¸öÄ¿±ê¶¼ÊÇÏàͬ
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Mirror_1.bak'
Mirror
To disk='G:\Backup\NorthwindCS_Mirror_2.bak'
With Format --µÚ´Î×ö¾µÏñ±¸·Ýʱºò¸ñʽ»¯Ä¿±ê
--¾µÏñ±¸·Ýµ½±¾µØºÍÔ¶³Ì
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Mirror_1.bak'
Mirror
To disk='\\192.168.1.200\Backup\NorthwindCS_Mirror_2.bak'
With Format
--ÿÌìÉú³É¸ö±¸·ÝÎļþ
Declare @Path Nvarchar(2000)
Set @Path ='G:\Backup\NorthwindCS_Full_'
+Convert(Nvarchar,Getdate,112)+'.bak'
Backup Database NorthwindCS
To http://www.hack58.net/Article/html/3/7/2008/mailtdisk=@Path
--´ÓNoRecovery»òÕß
--Standbyģʽ»Ö¸´Êý¾Ý¿âΪ¿ÉÓÃ
Restore Database NorthwindCS_Bak
With Recovery
--²é¿´Ä¿±ê±¸·ÝÖб¸·Ý¼¯
Restore HeaderOnly
from Disk ='G:\Backup\NorthwindCS_Full_20070908.bak'
--²é¿´Ä¿±ê±¸·ÝµÚ¸ö±¸·Ý¼¯ÐÅÏ¢


Ïà¹ØÎĵµ£º

sql ³£ÓõĴúÂë

£¨1£©
Mcirosoft JET SQL ÖУ¬ÈÕÆÚÓÑ#’¶¨½ç¡£ÈÕÆÚÒ²¿ÉÒÔÓÃDatevalue()º¯ÊýÀ´´úÌæ¡£ÔڱȽÏ×Ö·ûÐ͵ÄÊý¾Ýʱ£¬Òª¼ÓÉϵ¥ÒýºÅ’’£¬Î²¿Õ¸ñÔڱȽÏÖб»ºöÂÔ¡£
Àý£º
WHERE OrderDate>#96-1-1#
Ò²¿ÉÒÔ±íʾΪ£º
WHERE OrderDate>Datevalue(‘1/1/96’)
ʹÓà NOT ±í´ïʽÇó·´¡£
Àý£ ......

oracle SQL·ÖÀà

ORACLE ÖÐSQL Óï¾ä´óÖ¿ÉÒÔ·ÖΪ4´óÀà
1.DQL£¨data quary language Êý¾Ý²éѯÓïÑÔ£©
Êý¾Ý²éѯÓïÑÔDQL»ù±¾½á¹¹ÊÇÓÉSELECT×Ӿ䣬from×Ӿ䣬WHERE×Ó¾ä×é³É
2.DDL£¨data definition language Êý¾Ý¶¨ÒåÓïÑÔ£©
CREATE
ALTER
DROP
RENAME
TRUNCATE
3.DML£¨data manipulation language Êý¾Ý²Ù×ÝÓïÑÔ£©
INSERT
UPDATE ......

SQL Server Out Put Excel File

SQL Server Out Put Excel File
ÔÚ SQL ServerÖÐ, µ¼³öEXCEL Îļþ, Óõ½ bcp.exe
 
 bcp  µ¼³öµÄ±¾ÖÊÊÇ´¿Îı¾Îĵµ,
ÈôÊý¾Ýº¬ÓÐÖÐÎÄ,Çëµ¼³öµ½ÖÐÎÄ°æEXCEL,»òTXTÎĵµµÈ, ·ñÔòÂÒÂë....
ÓÃTXT ´ò¿ªÓ¢ÎÄ°æEXCEL,Ò²¿ÉÒÔ,
 
µ¼³ö Êý¾Ýµ½C:\authors.xls, ÈôÎļþ´æÔÚÔòÖØдÎļþ, ²»´æÔÚÔò´´½¨Îļþ
  ......

¼ÇÒ»¸ö×ÔÈÏΪдµÃÓе㸴ÔÓµÄsqlÓï¾ä

¼ÇÒ»¸ö×ÔÈÏΪдµÃÓе㸴ÔÓµÄsqlÓï¾ä£¬º¬ÒåÊÇ¿ç3ÕűíµÄselect£º
select table_name,column_name,data_type,data_length,data_scale from user_tab_columns where (data_type != 'NUMBER' or data_length != 22 or data_scale != 6) and (table_name,column_name) in (select upper(a.table_name_eng), upper(b.column_name_ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ