SqlServer²åÈëÂýµÄÎÊÌâ½â¾ö
Õâ¸öÊÇÎÒ¼ÓÈëµÄQQȺÀïÃæÒ»¸öÍøÓÑÎʵÄÎÊÌâ¡£Ëû˵һ¸ö±í×öÒ»¸öINSERT¶¼»á³¬Ê±¡£ÕýÀ§»óÄØ£¬ÏòȺÀïÃæµÄÈËÇóÖú¡£ÎҸպöÔÕâ·½ÃæÖªµÀµã£¬¾Í»Ø´ðÁË˵ҪÓÅ»¯¾Û¼¯Ë÷Òý¡£Ëû²»Ã÷°×¾ßÌå¸ÃÔõô×ö£¬ËƺõÒ²²»ÖªµÀʲôÊǾۼ¯Ë÷Òý¡£ÎÒ¶ÔËû˵Äã¿ÉÒÔ¿´¿´Äã²åÈë¼Ç¼ʱµÄ´ÅÅÌIOÊÇ·ñ±È½Ï¶à£¬Ëû˵ËûµÄ´ÅÅÌÒѾ»»³ÉÁËRAID£¬²»ºÃ²é¿´´ÅÅÌIO¡£OK, ÎÒ¼ÌÐøÌæËû·ÖÎöµÀ: ÄãÄǸöinsertÂýÊÇÒòΪÄãÿ´Î²åмǼ£¬Êý¾Ý¿â·þÎñÆ÷¶¼ÒªÔÚÖмäµÄÒ»¸öλÖòåÈ룬ÒýÆð´ÅÅÌÎļþµÄ´óÁ¿¶Áд. Ëû˵: ÈçºÎ½â¾ö? ÎÒµÄÓ²¼þÅäÖÃÒѾû·¨Éý¼¶ÁË. ÎÒ˵: Äã¿ÉÒÔ¿´¿´¾Û¼¯Ë÷Òý, ÒªÓÅ»¯¾Û¼¯Ë÷Òý. ËûËƺõ²»Ì«Ã÷°×, дÁËÏÂÃæÕâ䶫Î÷:
ÊÇÕâ¸öÂð£º
use WanerSoft2007
declare @table_id int
set @table_id=object_id('dbo.Ws_UserProInfo')
dbcc showcontig(@table_id)
dbcc dbreindex('dbo.Ws_UserProInfo','',0)
ÎÒ¿´ÁËÒ»ÏÂ, ˵ÕâÊÇÖØ×öË÷ÒýµÄÅú´¦Àí£¬²»ÊǾۼ¯Ë÷Òý.ÎÒ¼ÌÐø˵µÀ:¾Û¼¯Ë÷ÒýÊÇÖ¸¼Ç¼µÄÎïÀí°Ú·Å´ÎÐò¼´°´ÕÕ¾Û¼¯Ë÷ÒýÀ´×öµÄ¡£ÊÇ×îÖØÒªµÄÒ»¸öË÷Òý£¬¾Û¼¯Ë÷ÒýÉè¼ÆµÄºÃ£¬¶àÖÖÊý¾Ý¿â²Ù×÷¶¼¿ÉÒÔ»ñµÃºÃµÄÐÔÄÜ¡£Éè¼ÆµÄ²»ºÃ¾Í»áÒýÆðÐÔÄÜÉϵľ޴ó²îÒì, ±ÈÈç²åÈë²Ù×÷, Éè¼ÆµÃºÃʱ£¬Ð¼Ç¼ֻÐèÒªÔÚÎïÀíµÄ×îºóÌí¼Ó¾Í¿ÉÒÔÁË£¬²»ÐèÒªÒƶ¯ºÜ¶à¼Ç¼£¬ËùÒԿ죬Éè¼ÆµÃ²»ºÃʱ£¬Ð¼Ç¼¾ÍÊÇÔÚÎïÀíÉϵÄÖмäij¸öλÖòåÈ룬ÄÇô¾Í±ØÐëÒƶ¯ºÜ¶à¼Ç¼£¬¾Í»áÓдóÁ¿µÄ´ÅÅÌIO¡£ËûÈ¥ÕÒÁËÒ»»á£¬»ØÀ´¸øÎÒÌùÁ˸öͼ:
ÎÒ¿´ÁËͼ£¬¶ÔËû˵¾Û¼¯Ë÷ÒýҪѡÓö̵Ä×ֶΣ¬»¹Òªµ¥ÏòµÝÔö£¬¿ÉÒÔÑ¡ÈÕÆÚ£¬identityµÈ¡£ËûÕâ»Ø¾ÍÃ÷°×ÁË£¬ÎÊÊDz»ÊǾۼ¯Ë÷ÒýÀïÃæÈ¥µôbookidºÍnclassid×Ö¶Î. ÎÒ˵ÊÇ£¬ËûÕÕ×öÁË£¬ºóÀ´»ØÀ´Ëµ£¬Ì«ºÃÁË£¬ÎÊÌâ½â¾öÁË¡£
Ïà¹ØÎĵµ£º
·ÖÒ³´æ´¢¹ý³Ì
sp_QueryPaging
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author:
-- Create date:
-- Description: ·ÖÒ³²éѯ
-- ·µ»ØµÄÊý¾ÝÖÐ×ÜÊÇÔÚÿÌõ¼Ç¼ǰ¼ÓÉÏÐкÅRowNumberÁС£
-- Èç¹ûδָ¶¨@StrSelect²ÎÊý£¬Ï൱ÓÚÉèÖÃËüΪ'*'
-- Èç¹ûδ ......
È«ÎļìË÷ÊǶԴóÊý¾ÝÎı¾½øÐÐË÷Òý£¬ÔÚ½¨Á¢µÄË÷ÒýÖжÔÒª²éÕҵĵ¥´Ê½øÐнøÐÐËÑË÷£¬¶¨Î»ÄÄЩÎı¾Êý¾Ý°üÀ¨ÒªËÑË÷µÄµ¥´Ê¡£Òò´Ë£¬È«ÎļìË÷µÄÈ«²¿¹¤×÷¾ÍÊǽ¨Á¢Ë÷ÒýºÍÔÚË÷ÒýÖÐËÑË÷¶¨Î»£¬ËùÓеŤ×÷¶¼ÊÇΧÈÆÕâÁ½¸öÀ´½øÐеġ£ÏÂÃæ¾ÍÖð¸ö½éÉÜ¡£
¡¡¡¡½¨Á¢È«ÎÄË÷ÒýÖÐÓÐÁ½Ïî·Ç³£ÖØÒª£¬Ò»¸öÊÇÈçºÎ¶ÔÎı¾½øÐзִʣ¬Ò»Êǽ¨Á¢Ë÷ÒýµÄÊý¾Ý½á¹¹¡ ......
bcpÃüÁîÊÇSQL ServerÌṩµÄÒ»¸ö¿ì½ÝµÄÊý¾Ýµ¼Èëµ¼³ö¹¤¾ß¡£Ê¹ÓÃËü²»ÐèÒªÆô¶¯ÈκÎͼÐιÜÀí¹¤¾ß¾ÍÄÜÒÔ¸ßЧµÄ·½Ê½µ¼Èëµ¼³öÊý¾Ý¡£bcpÊÇSQL ServerÖиºÔðµ¼Èëµ¼³öÊý¾ÝµÄÒ»¸öÃüÁîÐй¤¾ß£¬ËüÊÇ»ùÓÚDB-LibraryµÄ£¬²¢ÇÒÄÜÒÔ²¢Ðеķ½Ê½¸ßЧµØµ¼Èëµ¼³ö´óÅúÁ¿µÄÊý¾Ý¡£bcp¿ÉÒÔ½«Êý¾Ý¿âµÄ±í»òÊÓͼֱ½Óµ¼³ö£¬Ò²ÄÜͨ¹ýSELECT fromÓï¾ä¶Ô±í»òÊÓ ......
Óû§È¨ÏÞ¹ÜÀí
Ò»¡¢·þÎñÆ÷µÇ¼ÕʺźÍÓû§ÕʺŹÜÀí
1.SQL Server·þÎñÆ÷µÇ¼¹ÜÀí
²»¹ÜʹÓÃÄÄÖÖÈÏ֤ģʽ£¬Óû§¶¼±ØÐëÏȾ߱¸ÓÐЧµÄÓû§µÇ¼Õʺš£SQL ServerÓÐÈý¸öĬÈϵÄÓû§µÇ¼Õʺţº¼´sa¡¢Builtin\administratorsºÍguest¡£saÊÇϵͳ¹ÜÀíÔ±(system administrator)µÄ¼ò³Æ£¬ÊÇÒ»¸öÌØÊâµÄÓû§£¬ÔÚSQL ServerϵͳºÍËùÓÐÊý¾Ý¿âÖÐÓ ......
eg:
select * from Exception_Log where DATEDIFF(day,OPER_DATE,getdate())<30 ;
/*
oper_date Ϊ±íÖвéѯ³öÀ´µÄʱ¼ä
getdate()ΪSQLServerÀïÃæ»ñµÃϵͳʱ¼äµÄº¯Êý
º¬Ò壺µ±Ç°Ê±¼ä-²éѯ³öÀ´µÄʱ¼äСÓÚ30Ìì
DateDiff¾ßÌåÓ÷¨£º
*/
DateDiff º¯Êý
·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄʱ¼ä¼ä¸ô¡£
DateDiff(interval, date1, da ......