SQLServerÊý¾Ý¿â
Sybase SQL ServerÌåϵ½á¹¹½éÉÜ
ÕªÒª£º±¾ÎÄÖ÷Òª¶ÔSybase SQL ServerÌåϵ½á¹¹½øÐнéÉÜ£¬±ãÓÚ¶ÁÕ߶ÔSybase SQL ServerÓиöÕûÌå´ó¸ÅµÄÁ˽⡣
±êÇ©£ºSybase SQL Server Sybase SQL Server Ìåϵ½á¹¹
Sybase SQL ServerÊÇÒ»¸ö¶à¿â½á¹¹µÄRDBMS£¬Ìåϵ½á¹¹´óÖÂÈçÏ£º
1.Êý¾Ý¿â
·þÎñÆ÷×ÔÉíËùʹÓõÄÊý¾Ý¿â£¬Ò²¿ÉÒÔ˵ÊǹÜÀí·þÎñÆ÷ºÍÓû§Êý¾Ý¿âµÄÊý¾Ý¿â¡£SybaseÔÚ°²×°Ê±£¬×Ô¶¯´´½¨ÁËËĸöϵͳÊý¾Ý¿â£º
master¡¢model¡¢tempdb¡¢sybsystemprocs
1) masterÊý¾Ý¿â
ËüÊǹÜÀíºÍ¿ØÖÆÓû§Êý¾Ý¿âÒÔ¼°Î¬»¤·þÎñÆ÷Õý³£ÔËÐеĺËÐÄÊý¾Ý¿â£¬Ëü±£´æÁË´óÁ¿µÄϵͳÐÅÏ¢£¬Èç·þÎñÆ÷ÅäÖá¢Óû§¡¢É豸µÈ¡£
ÔÚmasterÊý¾Ý¿âÖв»ÔÊÐíÆÕͨÓû§ÔÚÆäÖд´½¨Êý¾Ý¿â¶ÔÏ󣬷ñÔò»áʹµÃmasterÊý¾Ý¿âµÄÊÂÎñÈÕÖ¾ºÜ¿ì±äÂú¡£Èç¹ûÊÂÎñÈÕÖ¾Óþ¡£¬¾ÍÎÞ·¨Ê¹ÓÃdump transactionÃüÁîÊÍ·ÅmasterÊý¾Ý¿âÖеĿռ䡣
2)modelÊý¾Ý¿â
ËüÊÇΪ´´½¨Óû§Êý¾Ý¿â¶øÌṩµÄÄ£°å¡£Ã¿µ±´´½¨ÐµÄÊý¾Ý¿âʱ£¬SQL Server×Ô¶¯½¨Á¢modelÊý¾Ý¿âµÄÒ»·Ý¿½±´£¬²¢°ÑËüÀ©³äµ½Óû§ËùÒªÇóµÄ´óС£¬ÒÔ´Ë×÷ΪÐÂÓû§Êý¾Ý¿â¡£
ModelÊý¾Ý¿âÖаüº¬Ã¿¸öÓû§Êý¾Ý¿âËùÒªÇóµÄϵͳ±í¡£ModelÊý¾Ý¿â¿ÉÒÔ±»ÐÞ¸ÄÒԱ㶨ÖÆд´½¨µÄ¡£
3)tempdbÊý¾Ý¿â
ËüÊǸöÁÙʱÊý¾Ý¿â£¬Îª·þÎñÆ÷ÔËÐÐÓë´¦ÀíÌṩһ¸ö¹²ÏíµÄ´æ´¢ÇøÓò£¬Èçgroup byºÍorder byµÄÖмä½á¹û¾Í´æ·ÅÔÚÕâÀï¡£TempdbµÄ¿Õ¼äΪ·þÎñÆ÷ÖÐËùÓÐÊý¾Ý¿âµÄËùÓÐÓû§Ëù¹²Ïí¡£
ÿ´ÎÖØÆôSQL Server£¬·þÎñÆ÷µÄÒ»¸ö×Ô¶¯½ø³Ì¶¼¿½±´modelÊý¾Ý¿âµ½tempdbÊý¾Ý¿â£¬²¢Çå³ýtempdbÖÐÔÀ´µÄÄÚÈÝ¡£Òò´ËtempdbÖеÄÓû§±í¶¼ÊÇÁÙʱµÄ¡£ÁÙʱ±í·ÖΪÁ½Àࣺ¿É¹²ÏíµÄºÍ²»¿É¹²ÏíµÄ¡£²»¿É¹²ÏíµÄÁÙʱ±íÔÚÓÉcreate tableÖн«·ûºÅ#ÖÃÓÚ±íÃû֮ǰ´´Á¢£»¿É¹²ÏíµÄÁÙʱ±íͨ¹ýcreate tableÖÐÖ¸¶¨±íÃûǰ׺tempdb..¶ø´´Á¢¡£²»¿É¹²ÏíµÄÁÙʱ±íSQL Server×Ô¶¯ÎªÆäÌí¼ÓÊý×Öºó׺Ãû£¬ÇÒËüÖ»´æÔÚÓÚµ±Ç°»á»°ÖС£
4)sybsystemprocsÊý¾Ý¿âmasterÊý¾Ý¿â
ËüÊÇרÃÅÓÃÀ´±£´æϵͳÃüÁî(´æ´¢¹ý³Ì)µÄÊý¾Ý¿â£¬Èçsp_help¡¢sp_configure¡¢sp_helpdeviceµÈ¡£µ±ÈÎÒ»Êý¾Ý¿âÓû§ÔËÐÐÒÔsp_¿ªÍ·µÄ´æ´¢¹ý³Ìʱ£¬SQL Server°´ÕÕÒÔÏÂ˳Ðò²éÕÒ£ºµ±Ç°Êý¾Ý¿â¡¢sybsystemprocsÊý¾Ý¿â¡¢masterÊý¾Ý¿â¡£
2.Óû§Êý¾Ý¿â
Óû§Êý¾Ý¿âÊÇÎÒÃÇʹÓÃSybase·þÎñÆ÷µÄÕæÕýÄ¿µÄ¡£Òª¹ÜÀíÓû§Êý¾Ý£¬±ØÐëÔÚSybaseÖд´½¨×Ô¼ºµÄÊý¾Ý¿â£¬ËüÊÇÖ¸ÓÃcreate databaseÃüÁî´´½¨µÄÊý¾Ý¿â¡£²»ÄÜ´æÈ¡masterÊý¾Ý¿âµÄÓû§ÊÇÎÞȨ´´½¨ÐµÄÊý¾Ý¿âµÄ¡£
Êý¾Ý¿âÖеÄÖ÷Òª
Ïà¹ØÎĵµ£º
1.oracle»·¾³
create table test
(
id number(4),
name varchar2(20)
)
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯû±»×èÈû
2.sqlserver»·¾³
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯ±»×èÈû(Ê ......
bcpÃüÁîÊÇSQL ServerÌṩµÄÒ»¸ö¿ì½ÝµÄÊý¾Ýµ¼Èëµ¼³ö¹¤¾ß¡£Ê¹ÓÃËü²»ÐèÒªÆô¶¯ÈκÎͼÐιÜÀí¹¤¾ß¾ÍÄÜÒÔ¸ßЧµÄ·½Ê½µ¼Èëµ¼³öÊý¾Ý¡£bcpÊÇSQL ServerÖиºÔðµ¼Èëµ¼³öÊý¾ÝµÄÒ»¸öÃüÁîÐй¤¾ß£¬ËüÊÇ»ùÓÚDB-LibraryµÄ£¬²¢ÇÒÄÜÒÔ²¢Ðеķ½Ê½¸ßЧµØµ¼Èëµ¼³ö´óÅúÁ¿µÄÊý¾Ý¡£bcp¿ÉÒÔ½«Êý¾Ý¿âµÄ±í»òÊÓͼֱ½Óµ¼³ö£¬Ò²ÄÜͨ¹ýSELECT fromÓï¾ä¶Ô±í»òÊÓ ......
Oracle´æ´¢¹ý³Ìת³ÉSqlserver´æ´¢¹ý³Ì
1.ÈÕÆÚת»»
Oracle£º TO_NUMBER(TO_CHAR(SYSDATE, 'YYYYMMDD'))
SqlServer£ºCAST(CONVERT(CHAR(8),GETDATE(), 112) AS INT)
×¢£ºÆäÖБYYYYMMDD’¸ñʽ ¶ÔÓ¦112
2.ROWIDת»»
Oracle£º ROWID
SqlServer: PRIMARY KEY(±íÖ÷¼ü)
3.ROWNUM ......
΢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)……
(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
ʵ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´ ......
eg:
select * from Exception_Log where DATEDIFF(day,OPER_DATE,getdate())<30 ;
/*
oper_date Ϊ±íÖвéѯ³öÀ´µÄʱ¼ä
getdate()ΪSQLServerÀïÃæ»ñµÃϵͳʱ¼äµÄº¯Êý
º¬Ò壺µ±Ç°Ê±¼ä-²éѯ³öÀ´µÄʱ¼äСÓÚ30Ìì
DateDiff¾ßÌåÓ÷¨£º
*/
DateDiff º¯Êý
·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄʱ¼ä¼ä¸ô¡£
DateDiff(interval, date1, da ......