Sql ServerÖÐʹÓÃnewid()Ëæ»úº¯ÊýÈ¡³öÊý¾Ý
ÕâÖÖÓ÷¨ÏàÐÅÔÚÍøÕ¾Öо³£Ê¹Óã¬ÈçÒªÔÚ±íÖÐËæ»úÈ¡³ö10Ìõ¼Ç¼£¬Èç¹ûʹÓñà³ÌÓïÑÔ½øÐÐÔËËãµÄ»°»áºÜÂé·³¶øÇÒЧÂʵÍÏ¡£ÔÚSql ServerÖÐ×Ô´øÁËrandom()º¯ÊýÓÃÓÚÉú³ÉËæ»úÊý£¬ÆäʵËü»¹×Ô´øÁËÁíÍâÒ»¸öËæ»úº¯Êýnewid();newid()ÔÚɨÃèÿÌõ¼Ç¼ʱ¶¼»áÉú³ÉÒ»¸öËæ»úµÄÖµ£º
Ö´ÐÐselect newid()£»ÔËÐнá¹û
¿ÉÒÔ¿´µ½Õâ²¢²»ÊÇÒ»¸öËæ»úµÄÊý×ÖÀàÐÍ¡£
ÔÚ±íÖÐËæ»úÈ¡³önÌõ¼Ç¼£¬¾Í¿ÉÒÔʹÓÃselect top n * from table order by newid()ʵÏÖ£»
Ïà¹ØÎĵµ£º
sql serverÑ¡ÔñÁË»ìºÏģʽÎÊÌâ
ÒòΪҪѡÔñ»ìºÏģʽ²ÅÄÜʹÓÃsaÓû§µÇ¼µÄÎÊÌâ
È»ºóÆóÒµ¹ÜÀíÆ÷ÀïÃ澹ȻѡÁËÒÔºóûÓÐЧ¹û ÓÀÔ¶¶¼Êǽöwindowsģʽ
ÎÞÓï ²»¶ÏÖØÆômssql ÓÖÑ¡Ôñ »ìºÏģʽ ´óÔ¼¼¸·ÖÖÓºó¾¹È»¿ÉÒÔÑ¡ÔñÁË
zhenTMD µÄÎÞÄΣ¡ ......
SELECT OrderId, TableName, replace(PrimaryKeyColumn,'''','''''') as PrimaryKeyColumn, ColumnState,cast(IsUpdating as varchar) as IsUpdating, OperateTime, ValueColumn, SystemTypeID from SubCompFtpDataDairy where OperateTime>=dateadd(hh,-24,getdate()) ......
´ÓA±íËæ»úÈ¡10Ìõ¼Ç¼,ÓÃSELECT TOP 10 * from ywle order by newid()
order by Ò»°ãÊǸù¾Ýijһ×Ö¶ÎÅÅÐò,newid()µÄ·µ»ØÖµ ÊÇuniqueidentifier ,order by newid()Ëæ»úÑ¡È¡¼Ç¼ÊÇÈçºÎ½øÐеÄ
newid()ÔÚɨÃèÿÌõ¼Ç¼µÄʱºò¶¼Éú³ÉÒ»¸öÖµ, ¶øÉú³ÉµÄÖµÊÇËæ»úµÄ, ûÓдóСд˳Ðò. ËùÒÔ×îÖÕ½á¹ûÔÙ°´Õâ¸öÅÅÐò, ÅÅÐòµÄ½á¹ûµ±È»¾ÍÊÇÎ ......
¶¨Òå²Ù×÷Ô±
SQL Server´úÀíÍê³ÉÒ»¸ö×÷Òµºó£¬Í¨Öª²Ù×÷Ô±µÄ·½·¨ÓжàÖÖ¡£
ÀýÈ磬ͨ¹ýÃüÁîϵͳ°ÑÏàÓ¦µÄÏûϢдÈëWindows NTʼþÈÕÖ¾ÖУ¬ÒÔ±ã֪ͨϵͳ¹ÜÀíÔ±·´¸´¶ÁÈ¡´ËÈÕÖ¾¡£
ÁíÍâÒ»ÖÖ¸üºÃµÄÑ¡Ôñ¾ÍÊÇʹÓõç×ÓÓʼþ¡¢´«ºô»ú»òÍøÂç´«ËͰѾ¯±¨ÏûϢ֪ͨ¸ø²Ù×÷Ô±¡£²Ù×÷Ô±ÊÇSQL Server´úÀí·¢ËÍÏûÏ¢µÄ½ÓÊÕÕߣ¬²Ù×÷Ô±¿ÉÒÔÔÚÒ»¸ö×÷ҵ֮ǰ ......