SQL Ñ»·
declare @i int
set @i=1
while @i<30
begin
insert into test (userid) values(@i)
set @i=@i+1
end
---------------
while Ìõ¼þ
begin
Ö´ÐвÙ×÷
set @i=@i+1
end
WHILE
ÉèÖÃÖظ´Ö´ÐÐ SQL Óï¾ä»òÓï¾ä¿éµÄÌõ¼þ¡£Ö»ÒªÖ¸¶¨µÄÌõ¼þΪÕ棬¾ÍÖظ´Ö´ÐÐÓï¾ä¡£¿ÉÒÔʹÓà BREAK ºÍ CONTINUE ¹Ø¼ü×ÖÔÚÑ»·ÄÚ²¿¿ØÖÆ WHILE Ñ»·ÖÐÓï¾äµÄÖ´ÐС£
Óï·¨
WHILE Boolean_expression
{ sql_statement | statement_block }
[ BREAK ]
{ sql_statement | statement_block }
[ CONTINUE ]
²ÎÊý
Boolean_expression
·µ»Ø TRUE »ò FALSE µÄ±í´ïʽ¡£Èç¹û²¼¶û±í´ïʽÖк¬ÓÐ SELECT Óï¾ä£¬±ØÐëÓÃÔ²À¨ºÅ½« SELECT Óï¾äÀ¨ÆðÀ´¡£
{sql_statement | statement_block}
Transact-SQL Óï¾ä»òÓÃÓï¾ä¿é¶¨ÒåµÄÓï¾ä·Ö×é¡£ÈôÒª¶¨ÒåÓï¾ä¿é£¬ÇëʹÓÿØÖÆÁ÷¹Ø¼ü×Ö BEGIN ºÍ END¡£
BREAK
µ¼Ö´Ó×îÄÚ²ãµÄ WHILE Ñ»·ÖÐÍ˳ö¡£½«Ö´ÐгöÏÖÔÚ END ¹Ø¼ü×ÖºóÃæµÄÈκÎÓï¾ä£¬END ¹Ø¼ü×ÖΪѻ·½áÊø±ê¼Ç¡£
CONTINUE
ʹ WHILE Ñ»·ÖØпªÊ¼Ö´ÐУ¬ºöÂÔ CONTINUE ¹Ø¼ü×ÖºóµÄÈκÎÓï¾ä¡£
×¢ÊÍ
Èç¹ûǶÌ×ÁËÁ½¸ö»ò¶à¸ö WHILE Ñ»·£¬ÄÚ²ãµÄ BREAK ½«µ¼ÖÂÍ˳öµ½ÏÂÒ»¸öÍâ²ãÑ»·¡£Ê×ÏÈÔËÐÐÄÚ²ãÑ»·½áÊøÖ®ºóµÄËùÓÐÓï¾ä£¬È»ºóÏÂÒ»¸öÍâ²ãÑ»·ÖØпªÊ¼Ö´ÐС£
ʾÀý
A. ÔÚǶÌ×µÄ IF...ELSE ºÍ WHILE ÖÐʹÓà BREAK ºÍ CONTINUE
ÔÚÏÂÀýÖУ¬Èç¹ûƽ¾ù¼Û¸ñÉÙÓÚ $30£¬WHILE Ñ»·¾Í½«¼Û¸ñ¼Ó±¶£¬È»ºóÑ¡Ôñ×î¸ß¼Û¡£Èç¹û×î¸ß¼ÛÉÙÓÚ»òµÈÓÚ $50£¬WHILE Ñ»·ÖØÐÂÆô¶¯²¢Ôٴν«¼Û¸ñ¼Ó±¶¡£¸ÃÑ»·²»¶ÏµØ½«¼Û¸ñ¼Ó±¶Ö±µ½×î¸ß¼Û¸ñ³¬¹ý $50£¬È»ºóÍ˳ö WHILE Ñ»·²¢´òÓ¡Ò»ÌõÏûÏ¢¡£
USE pubs
GO
WHILE (SELECT AVG(price) from titles) < $30
BEGIN
UPDATE titles
SET price = price * 2
SELECT MAX(price) from titles
IF (SELECT MAX(price) from titles) > $50
BREAK
ELSE
CONTINUE
END
PRINT 'Too much for the market to bear'
B. ÔÚ´øÓÐÓαêµÄ¹ý³ÌÖÐʹÓà WHILE
ÒÔÏ嵀 WHILE ½á¹¹ÊÇÃûΪ count_all_rows ¹ý³ÌÖеÄÒ»²¿·Ö¡£ÏÂÀýÖУ¬¸Ã WHILE ½á¹¹²âÊÔÓÃÓÚÓαêµÄº¯Êý @@FETCH_STATU
Ïà¹ØÎĵµ£º
SQLÓÅ»¯²éѯ
ÊÕ²Ø
Êý¾Ý¿âµÄ²éѯÓÅ»¯¼¼Êõ
Êý¾Ý¿âϵͳÊǹÜÀíÐÅϢϵͳµÄºËÐÄ£¬»ùÓÚÊý¾Ý¿âµÄÁª»úÊÂÎñ´¦Àí£¨OLTP£©ÒÔ¼°Áª»ú·ÖÎö´¦Àí(OLAP)ÊÇÒøÐС¢ÆóÒµ¡¢Õþ¸®µÈ²¿ÃÅ×îΪÖØÒªµÄ¼ÆËã»úÓ¦
ÓÃÖ®Ò»¡£´Ó´ó¶à ......
MDX º¯Êý²Î¿¼
SQL Server 2008 Áª»ú´ÔÊ飨2009 Äê 7 Ô£©
MDX º¯Êý²Î¿¼ (MDX)
Microsoft SQL Server Analysis Services ÔÊÐíÔÚ¶àά±í´ïʽ (MDX) Óï·¨ÖÐʹÓú¯Êý¡£º¯Êý¿ÉÒÔÔÚÈκÎÓÐЧµÄ MDX Óï¾äÖÐʹÓ㬲¢ÇÒ¾³£ÓÃÓÚ²éѯ¡¢×Ô¶¨Òå»ã×ܶ¨ÒåÒÔ¼°ÆäËû¼ÆËã¡£ ±¾½Ú½éÉÜ Analysis Services ¸½´øµÄ MDX º¯Êý¡£
¿ÉÒÔʹÓÃÏÂÃæÕâÐ ......
<!--MySql Çý¶¯³ÌÐò eg. mysql-connector-java-5.0.4-bin.jar-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- JDBC URL -->
......
VS2010ÒѾ·¢²¼¼¸Ììʱ¼äÁË£¬Ò»Ð©ÐµÄÌØÐÔÌرðÒýÈËעĿ£¬±ÈÈ磺 ÐÔÄܵÄÎȶ¨ºÍÌáÉý£¬±íÏÖÔÚWPF GUIºÍWPFÎı¾³ÊÏÖ¡£ Windows Azure ToolsÄ£°å¡£ ¶àÏÔʾÆ÷Ö§³Ö£¬Êä³ö´°¿Ú£¬Ààͼ´°¿Ú£¬´úÂ붨Òå´°¿ÚµÈÌṩ¸¨ÖúÐÅÏ¢µÄ´°¿Ú·ÅÖÃÔÚ¸±ÏÔʾÆ÷ÖС£ ¶Ô²¢ÐмÆË㿪·¢µÄ´óÁ¿Ö§³Ö¡£ °üº¬ÁËSharePointµÄÏîÄ¿Ä£°åºÍµ÷ÊÔÖ§³Ö ......