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

¾«ÃîSQLÓï¾ä

 1.°´ÐÕÊϱʻ­ÅÅÐò:
Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.·ÖÒ³SQLÓï¾ä
select * from(select (row_number() OVER (ORDER BY tab.ID Desc)) as rownum,tab.* from ±íÃû As tab) As t where rownum between ÆðʼλÖà And ½áÊøλÖÃ
3.»ñÈ¡µ±Ç°Êý¾Ý¿âÖеÄËùÓÐÓû§±í
select * from sysobjects where xtype='U' and category=0
4.»ñȡijһ¸ö±íµÄËùÓÐ×Ö¶Î
select name from syscolumns where id=object_id('±íÃû')
5.²é¿´Óëijһ¸ö±íÏà¹ØµÄÊÓͼ¡¢´æ´¢¹ý³Ì¡¢º¯Êý
select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%±íÃû%'
6.²é¿´µ±Ç°Êý¾Ý¿âÖÐËùÓд洢¹ý³Ì
select name as ´æ´¢¹ý³ÌÃû³Æ from sysobjects where xtype='P'
7.²éѯÓû§´´½¨µÄËùÓÐÊý¾Ý¿â
select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')
»òÕß
select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01
8.²éѯijһ¸ö±íµÄ×ֶκÍÊý¾ÝÀàÐÍ
select column_name,data_type from information_schema.columns
where table_name = '±íÃû'
9.ʹÓÃÊÂÎñ
ÔÚʹÓÃһЩ¶ÔÊý¾Ý¿â±íµÄÁÙʱµÄSQLÓï¾ä²Ù×÷ʱ£¬¿ÉÒÔ²ÉÓÃSQL SERVERÊÂÎñ´¦Àí£¬·ÀÖ¹¶ÔÊý¾Ý²Ù×÷ºó·¢ÏÖÎó²Ù×÷ÎÊÌâ
¿ªÊ¼ÊÂÎñ
Begin tran
  Insert Into TableName Values(…)
SQLÓï¾ä²Ù×÷²»Õý³££¬Ôò»Ø¹öÊÂÎñ¡£
»Ø¹öÊÂÎñ
Rollback tran
SQLÓï¾ä²Ù×÷Õý³££¬ÔòÌá½»ÊÂÎñ£¬Êý¾ÝÌá½»ÖÁÊý¾Ý¿â¡£
Ìá½»ÊÂÎñ
Commit tran
10. °´È«ÎÄÆ¥Å䷽ʽ²éѯ
×Ö¶ÎÃû LIKE N'%[^a-zA-Z0-9]China[^a-zA-Z0-9]%'
OR ×Ö¶ÎÃû LIKE N'%[^a-zA-Z0-9]China'
OR ×Ö¶ÎÃû LIKE N'China[^a-zA-Z0-9]%'
OR ×Ö¶ÎÃû LIKE N'China
11£®¼ÆËãÖ´ÐÐSQLÓï¾ä²éѯʱ¼ä
declare @d datetime
set @d=getdate()
select * from SYS_ColumnProperties select [Óï¾äÖ´Ðл¨·Ñʱ¼ä(ºÁÃë)]=datediff(ms,@d,getdate())
12¡¢ËµÃ÷£º¼¸¸ö¸ß¼¶²éѯÔËËã´Ê
A£º UNION ÔËËã·û
UNION ÔËËã·ûͨ¹ý×éºÏÆäËûÁ½¸ö½á¹û±í£¨ÀýÈç TABLE1 ºÍ TABLE2£©²¢ÏûÈ¥±íÖÐÈκÎÖظ´ÐжøÅÉÉú³öÒ»¸ö½á¹û±í¡£µ± ALL Ëæ UNION Ò»ÆðʹÓÃʱ£¨¼´ UNION ALL£©£¬²»Ïû³ýÖظ´ÐС£Á½ÖÖÇé¿öÏ£¬ÅÉÉú±íµÄÿһÐв»ÊÇÀ´×Ô TABLE1 ¾ÍÊÇÀ´×Ô TABLE2¡£
B£º EXCEPT ÔËËã·û
EXCEPT ÔËËã·ûͨ¹ý°üÀ


Ïà¹ØÎĵµ£º

Ò»¸ösql·ÖÒ³µÄ´æ´¢¹ý³Ì

 CREATE  procedure SqlPager_Ex
 @sqlstr varchar(8000), --²éѯ×Ö·û´®
  @currentpage int, --µÚNÒ³
  @pagesize int --ÿҳÐÐÊý, 
 as
  set nocount on
  declare @P1 int, --P1ÊÇÓαêµÄid
   @rowcount int
  exec sp_cursorope ......

SQL UNIQUEIDENTIFIER

µ±ÄãÕýÔÚ´¦Àí±»¶à¸öÕ¾µã£¨ÏñÔÚ¿ç¹ú¹«Ë¾Ìõ¼þÏ£©Ê¹ÓõĴóÊý¾Ý¿âʱ£¬ÄãÒ²Ðí»áÓöµ½±£Ö¤±í¸ñ¶ÔÏóΨһÐÔÕâÑùµÄ¼¬ÊÖÎÊÌâ¡£ÔÚÕâÖÖÇéÐÎÏ£¬¿ÉÄÜÖ»ÄÜ¿¿UNIQUEIDENTIFIERÀ´½â¾ö¡£UNIQUEIDENTIFIERÊÇÒ»¸ö±£´æÈ«¾ÖΨһ±êʶ·ûµÄGUIDÊý¾ÝÀàÐÍ¡£GUIDÊÇÒ»¸ö±£Ö¤Î¨Ò»µÄ¶þ½øÖÆÊý£¬Òò´Ë¼¸ºõûÓбðµÄ¼ÆËã»ú»á²úÉúͬһ¸öÖµ¡£
GUIDµÄΨһֵÊÇÓÉ¼Æ ......

SQL Server 2005 Analysis Services²¿Êðʱ±¨¸æ´íÎó

 Êý¾ÝÔ´......°üº¬ÎÞ·¨ÓÃÓÚ´¦Àí²Ù×÷µÄ ImpersonationMode¡£
½â¾ö·½·¨£º
·þÎñÆ÷Á¬½Ó¸ÄΪ“ʹÓ÷þÎñÕË»§”¡£
¾ßÌå²Ù×÷£º
ÔÚÊý¾ÝÔ´ÀïµÄÏîÄ¿Éϵã»÷ÓÒ¼ü->´ò¿ª->Êý¾ÝÔ´Éè¼ÆÆ÷ £¬ Ñ¡Ôñ“Ä£ÄâÐÅÏ¢”±êÇ©->Ñ¡Ôñ“ʹÓ÷þÎñÕË»§”£¬È·¶¨£¬Ö´Ðв¿Êð¡£ ......

ÈçºÎÓÅ»¯SQL ServerÊý¾Ý¿â²éѯ(ת)

 1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)¡¡¡¡
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£¡¡¡¡
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£¡¡¡¡
¡¡¡¡4¡¢ÄÚ´æ²»×ã¡¡¡¡
¡¡¡¡5¡¢ÍøÂçËÙ¶ÈÂý¡¡¡¡
¡¡¡¡6¡¢²éѯ³öµÄÊý¾ÝÁ¿¹ý´ó£¨¿ÉÒÔ²ÉÓöà´Î²éѯ£¬ÆäËûµÄ·½·¨½µµÍÊý¾ÝÁ¿£©¡¡¡¡
¡¡¡¡7¡¢Ëø»òÕßËÀËø ......

OracleÖУ¬ÓÃÒ»ÌõSqlʵÏÖÈÎÒâµÄÐÐתÁÐÆ´½Ó ¶àÐÐÆ´½Ó

 ±í½á¹¹ºÍÊý¾ÝÈçÏ£¨±íÃûTest£©£º
NO VALUE  NAME
1       a       ²âÊÔ1
1       b       ²âÊÔ2
1       c       ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ