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

SQl×Ô¶¯±¸·Ýɾ³ý

BackupEveryDay
ÿÌì½øÐÐÊý¾Ý¿âµÄ²îÒ챸·Ý
day
Declare @File Varchar(2000)
Set @File='E:\Databasebackup\njyc_data_diff.BAK'
Backup database njyc_data to Disk=@File with DIFFERENTIAL
WeekBackup
ÿÖܽøÐÐÒ»´ÎÊý¾Ý¿âµÄÍêÈ«±¸·Ý£¬±¸·ÝÎļþÃûΪµ±ÌìÈÕÆÚ £¨njyc_data_Äê_ÔÂ_ÈÕ£©
BackupAll
DECLARE @BackupFile Varchar(256)
SET @BackupFile='E:\Databasebackup\'
SET @BackupFile=@BackupFile+'njyc_data_'+Replace(convert(varchar(10),getdate(),120),'-','_')
Backup DataBase njyc_data to Disk=@BackupFile with Init
BackupDiffrent
DECLARE @BackupFile Varchar(256)
SET @BackupFile='E:\Databasebackup\'
SET @BackupFile=@BackupFile+'njyc_data_diff.bak'
Backup DataBase njyc_data to Disk=@BackupFile with Init
EveryWeek
DeleteLastmonth
--ÅжÏÎļþÊÇ·ñ´æÔÚ
create table ##tb(a bit,b bit,c bit)
DECLARE @DelFile Varchar(256)
set @DelFile='E:\Databasebackup\'
set @DelFile=@DelFile+'njyc_data_'+Replace(convert(varchar(10),getdate()-28,120),'-','_')
insert into ##tb
exec master..xp_fileexist @DelFile
--Îļþ´æÔÚÔòɾ³ý
if exists(select 1 from ##tb where a=1)
begin
DECLARE @Delsql Varchar(256)
set @Delsql='Del '+ @DelFile
Exec  master..xp_cmdshell  @Delsql
end
drop table ##tb


Ïà¹ØÎĵµ£º

Sql server 2005 µÇ¼ɨä

1.       ÔÚʹÓÃsql server ֮ǰÄØ£¬×îºÃ¶ÔÆä½øÐÐÅäÖÃ
(1)  ÅäÖù¤¾ß->Sql server configuration Manager  
        Ñ¡ÔñSql server 2005Íø·ÅäÖà Ï嵀 MSSQLSERVERµÄЭÒé ÔÚ´°¿ÚÓұߵÄ
TCP/IPЭÒéÓÒ¼üÊôÐÔ£¬ÅäÖÃÈçÏÂ
 
&n ......

¶¯Ì¬´´½¨sqlʵÀý

string   error_syntaxfromSQL,   error_create  
  string   new_sql,   new_syntax  
  new_sql   =   'SELECT   emp_data.emp_id,   '   &  
    & ......

oracle SQLÐÔÄÜÓÅ»¯

ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£©      Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£ ......

sqlµÄ INNER JOIN, left join,right joinÓï·¨

inner join(µÈÖµÁ¬½Ó) Ö»·µ»ØÁ½¸ö±íÖÐÁª½á×Ö¶ÎÏàµÈµÄÐÐ
left join(×óÁª½Ó) ·µ»Ø°üÀ¨×ó±íÖеÄËùÓмǼºÍÓÒ±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
right join(ÓÒÁª½Ó) ·µ»Ø°üÀ¨ÓÒ±íÖеÄËùÓмǼºÍ×ó±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
INNER JOIN Óï·¨£º
INNER JOIN Á¬½ÓÁ½¸öÊý¾Ý±íµÄÓ÷¨£º
SELECT * from ±í1 INNER JOIN ±í2 ON ±í1.×ֶκÅ=±í2 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ