SQLÖÐcase when thenµÄʹÓÃʵÀý
¼ÙÉèÏÖÔÚNews±íÓÐÒÔÏÂ×Ö¶Î
News_Id,News_Title,News_IsSetTop,News_SetTopTime
ÆäÖÐNews_IsSetTop(char(1))ÊÇ“ÊÇ·ñÖö¥”µÄº¬Ò壻News_SetTopTime(DateTime)ÊÇÖö¥Ê±¼ä£»
ÏÖÔÚҪʵÏÖ£ºÈç¹ûNews_IsSetTopΪ"1"ʱ £¬ORDER BY News_IsSetTop DESC,News_Id DESC£»News_IsSetTopΪ"0"ʱ£¬ORDER BY News_ID DESC
¾¹ý·´¸´µÄÊÔÑ飬ÖÕÓÚ½â¾öÁËÕâ¸öÎÊÌ⣺
select
news_id,news_issettop,news_settoptime
from
hope_T_news
order by
(case when news_issettop=’0′ then news_issettop
when news_issettop=’1′ and news_settoptime>getdate() and news_settoptime<dateadd(day,3,getdate()) then news_id
end)
desc,news_id desc
Ïà¹ØÎĵµ£º
1¡¢ÏÂÔرر¸Èí¼þ
(1) JDK (Java Development Kit)
SUN¹Ù·½µÄÏÂÔصØÖ·ÊÇhttp://java.sun.com/javase/downloads/index.jsp
(2) JDBC
(3) Eclipse
(4) Microsoft SQL Server 2005 Express£¨µ±È»£¬ÓзÇExpressÒ²OK°¡£©
(5) SQL Server Management Studio
2¡¢°²×°Óë»·¾³ÅäÖÃ
(1) JDK
Ê×ÏÈÔÚWindows»·¾³Ï£¬ÏÂÔغó° ......
declare @str varchar(50)
declare @i int
set @str = ''
set @i=0
while @i<50
begin
set @str = ......
´ÓA±íËæ»úÈ¡10Ìõ¼Ç¼,ÓÃSELECT TOP 10 * from ywle order by newid()
order by Ò»°ãÊǸù¾Ýijһ×Ö¶ÎÅÅÐò,newid()µÄ·µ»ØÖµ ÊÇuniqueidentifier ,order by newid()Ëæ»úÑ¡È¡¼Ç¼ÊÇÈçºÎ½øÐеÄ
newid()ÔÚɨÃèÿÌõ¼Ç¼µÄʱºò¶¼Éú³ÉÒ»¸öÖµ, ¶øÉú³ÉµÄÖµÊÇËæ»úµÄ, ûÓдóСд˳Ðò. ËùÒÔ×îÖÕ½á¹ûÔÙ°´Õâ¸öÅÅÐò, ÅÅÐòµÄ½á¹ûµ±È»¾ÍÊÇÎ ......
public static void main(String[] args) {
Session session = null;
Transaction tx = null;
List list = null;
&nb ......
¶¨Òå²Ù×÷Ô±
SQL Server´úÀíÍê³ÉÒ»¸ö×÷Òµºó£¬Í¨Öª²Ù×÷Ô±µÄ·½·¨ÓжàÖÖ¡£
ÀýÈ磬ͨ¹ýÃüÁîϵͳ°ÑÏàÓ¦µÄÏûϢдÈëWindows NTʼþÈÕÖ¾ÖУ¬ÒÔ±ã֪ͨϵͳ¹ÜÀíÔ±·´¸´¶ÁÈ¡´ËÈÕÖ¾¡£
ÁíÍâÒ»ÖÖ¸üºÃµÄÑ¡Ôñ¾ÍÊÇʹÓõç×ÓÓʼþ¡¢´«ºô»ú»òÍøÂç´«ËͰѾ¯±¨ÏûϢ֪ͨ¸ø²Ù×÷Ô±¡£²Ù×÷Ô±ÊÇSQL Server´úÀí·¢ËÍÏûÏ¢µÄ½ÓÊÕÕߣ¬²Ù×÷Ô±¿ÉÒÔÔÚÒ»¸ö×÷ҵ֮ǰ ......