SQL Server 2008×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä
н¨Êý¾Ý±íÒÔºó£¬ÈôÔٶԸñí½øÐиü¸Ä£¬Ôò»á³öÏÖ¾¯¸æÐÅÏ¢“²»ÔÊÐí±£´æ¸ü¸Ä ×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä”£¬µÈµÈ£¬ÐèÒª½øÐÐÒ»ÏÂÉèÖ㺹¤¾ß--->Ñ¡Ïî--->Designers--->±íÉè¼ÆÆ÷ºÍÊý¾Ý¿âÉè¼ÆÆ÷--->×éÖ¯±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä£¬È¥µô¸´Ñ¡¿ò¡£
À´Ô´ÍøÂ磺“²»ÊǺÜÀí½âΪʲôÔÚ2008Öлá¼ÓÈë"×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä"Õâ¸öÑ¡Ïî.Ö¢×´±íÏÖΪÐ޸ıí½á¹¹µÄʱºò»á"×èÖ¹"Äã.¶øÇÒÎÒÓöµ½µÄÇé¿öÊǾÓÈ»ÓеÄʱºò×èÖ¹Äã,ÓеÄʱºò²»×èÖ¹Äã,Ãþ²»µ½Í·ÄÔ.½¨Òé³õѧÊý¾Ý¿âµÄÅóÓÑÔÚʹÓõÄʱºòÈ¡ÏûÕâ¸öÑ¡Ïî,·½Ê½ÊÇÔÚManagement StudioÀïÕҲ˵¥À¸ÉϵÄ"¹¤¾ß"È»ºóµã»÷ÏÂÃæµÄÑ¡Ïî,ÔÚ³öÏÖµÄÏÂÃæµÄÕâ¸ö½çÃæÖÐÕ¹¿ªDesigners,Ñ¡ÖÐ"±íÉè¼ÆÆ÷ºÍÊý¾Ý¿âÉè¼ÆÆ÷",°Ñ"×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä"Ç°ÃæµÄ¹´´òµô.”
Ïà¹ØÎĵµ£º
--SQL Server£º
Select TOP N * from TABLE Order By NewID()
--Access£º
Select TOP N * from TABLE Order By Rnd(ID)
Rnd(ID) ÆäÖеÄIDÊÇ×Ô¶¯±àºÅ×ֶΣ¬¿ÉÒÔÀûÓÃÆäËûÈκÎÊýÖµÀ´Íê³É£¬±ÈÈçÓÃÐÕÃû×Ö¶Î(U ......
½ñÌìÓÃtime Like '2008-06-01%'Óï¾äÀ´²éѯ¸ÃÌìµÄËùÓÐÊý¾Ý£¬±»ÌáʾÓï¾ä´íÎó¡£²éÁËһϲŷ¢ÏÖ¸ÃÄ£ºý²éѯֻÄÜÓÃÓÚStringÀàÐ͵Ä×ֶΡ£
×Ô¼ºÒ²²éÔÄÁËһЩ×ÊÁÏ¡£¹ØÓÚʱ¼äµÄÄ£ºý²éѯÓÐÒÔÏÂÈýÖÖ·½·¨£º
1.Convertת³ÉString,ÔÚÓÃLike²éѯ¡£
select * from table1 where c ......
¼¸¸ö´æ´¢¹ý³Ì£¬ºÜ¼òµ¥µÄ£¬µ«ÊÇÎÒ´ÓÀ´Ã»ÓÐѧϰ¹ý£¬ºÇºÇ£¬Õâ¸öÕýÊÇÎÒÒªÀ´ÅàѵµÄÄ¿µÄ
-- =============================================
-- Author:
-- Create date: 2010Äê05ÔÂ12ÈÕ
-- Description: ´Ë¹ý³ÌÓÃÓÚ²éѯËùÓÐÓû§Ãû¼°ÃÜÂë
-- =============================================
CREATE PROCED ......
SQLÓï¾ä¼¶±ðµÄÓÅ»¯ÊÇÎÒÃÇʵ¼Ê¹¤×÷ÖнӴ¥×î¶àµÄ£¬¼¸ºõËùÓеÄÊý¾Ý¿âÓ¦ÓÃ˵µ½µ×¶¼ÊÇSQLÓï¾äµÄ¾ßÌåÖ´ÐУ¬Òò´ËÈçºÎ¶ÔSQL½Å±¾±¾Éí½øÐÐÓÅ»¯£¬Ìá¸ßÖ´ÐÐЧÂʾÍÏÔµÃÓÈΪÖØÒª¡£ÒÔÏÂÊÇһЩͨÓõÄÉè¼ÆÔÔò¡£
(1)ʹÓÃselectÓï¾ä²éѯʱ£¬¾¡Á¿²»ÒªÊ¹ÓÃselect *¡¡Óï¾ä£¬¶øÊÇÓ¦¸ÃÖ¸Ã÷¾ßÌåÒª²éѯµÄ×ֶΣ¬ÌáÈ¡µÄ×Ö¶ÎÊýÁ¿Ô½É ......
ALTER function [dbo].[split]
(
@SourceSql varchar(8000),
@StrSeprate varchar(10)
)
returns @temp table(F1 varchar(100))
as
begin
declare @i int
set @SourceSql = rtrim(ltrim(@SourceSql))
set @i = charindex(@StrSeprate,@SourceSql)
while @i >= 1
begin
if len( ......