SQL UNIQUEIDENTIFIER
µ±ÄãÕýÔÚ´¦Àí±»¶à¸öÕ¾µã£¨ÏñÔÚ¿ç¹ú¹«Ë¾Ìõ¼þÏ£©Ê¹ÓõĴóÊý¾Ý¿âʱ£¬ÄãÒ²Ðí»áÓöµ½±£Ö¤±í¸ñ¶ÔÏóΨһÐÔÕâÑùµÄ¼¬ÊÖÎÊÌâ¡£ÔÚÕâÖÖÇéÐÎÏ£¬¿ÉÄÜÖ»ÄÜ¿¿UNIQUEIDENTIFIERÀ´½â¾ö¡£UNIQUEIDENTIFIERÊÇÒ»¸ö±£´æÈ«¾ÖΨһ±êʶ·ûµÄGUIDÊý¾ÝÀàÐÍ¡£GUIDÊÇÒ»¸ö±£Ö¤Î¨Ò»µÄ¶þ½øÖÆÊý£¬Òò´Ë¼¸ºõûÓбðµÄ¼ÆËã»ú»á²úÉúͬһ¸öÖµ¡£
GUIDµÄΨһֵÊÇÓɼÆËã»úÍø¿¨µÄ±êʶÊý¼ÓÉÏÒ»¸öCPUʱÖÓ²úÉúµÄΨһÊý¶øµÃµ½µÄ¡£Íø¿¨ÖÆÔìÉÌÖÁÉÙÔÚÏÂÒ»¸ö100ÄêÄÚÄܱ£Ö¤Íø¿¨µÄΨһÐÔ¡£
UNIQUEIDENTIFIERÖµ²»ÄÜÏñIDENTITYÊôÐÔÄÇÑù×Ô¶¯²úÉú¡£ÒªÏëΪÄãµÄ±í¸ñ¶ÔÏó²úÉúUNIQUEIDENTIFIERÖµ£¬Äã±ØÐëÖ¸¶¨NEWIDº¯ÊýΪcolumnµÄȱʡֵ¡£
ÀýÈ磬Èç¹ûÄãÏëÒª´´½¨Ò»¸ö±í¸ñÁгöÄãµÄ¿ç¹ú¹«Ë¾µÄËùÓÐ×Ó¹«Ë¾µÄ¼â¶Ë²úÆ·µÄÊÕÈ룬²¢ÇÒÄãÏ£ÍûÖ¸¶¨Ò»¸öGUIDÊý¾ÝÀàÐÍ£¬ÄÇôÄã¿ÉÒÔ¼üÈ룺
CREATE TABLE NetRevenueTable
(UniqueColumn UNIQUEIDENTIFIER DEFAULT NEWID(),
Characters VARCHAR(10))
ÔÚÊý¾Ý¿â¹¤¾ßÖУ¬ÄãÒªÔÚÊý¾Ý¿âͼ±íÖлòµ±ÄãÕýÔÚÉè¼ÆÒ»¸ö±í¸ñʱ×öÕâ¼þÊÂÇ顣ΪÄãÏëΨһȷ¶¨µÄcolumnÑ¡ÔñIs RowGUID¡£È±Ê¡Çé¿ö½«ÊÇ(newid())£¬Ëü×Ô¶¯²úÉúRowGUID¡£
¾¡¹ÜÔÚÐí¶àÇé¿öÏÂÄã±ØÐë±£Ö¤±í¸ñ¶ÔÏóµÄΨһÐÔ£¬µ«ÊÇÈç¹ûÄã¾ö¶¨Ê¹ÓÃUNIQUEIDENTIFIERÊý¾ÝÀàÐÍ£¬Çë×¢ÒâÒÔÏÂÌØÐÔ£º
ÕâЩֵÊdz¤¶øÇÒÄѶ®µÄ¡£
ÕâЩֵÊÇËæ»úµÄ£¬²»´øÓжÔÓû§ÓÐÒâÒåµÄÑùʽ¡£
ÕâЩֵÔÚÒÀ¿¿Á¬ÐøÔö¼ÓµÄÖµµÄÓ¦ÓóÌÐòÖкÜÄÑʹÓá£
ÕâЩֵÓÐ16×Ö½Ú£¬ºÜ´ó£¬Òò´ËÓÃÕâЩԿ³×¹¹½¨Ë÷Òý»á¸üÂý¡£
Ïà¹ØÎĵµ£º
WITH V AS(SELECT ROW_NUMBER() OVER(order by fcustid desc) AS RN,* from ts_dict AS SourceView)
SELECT * from V WHERE RN BETWEEN 1 AND 10
תÔصØÖ·£ºhttp://www.cnblogs.com/nokiaguy/archive/2009/02/05/1384860.html
ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº ......
·½·¨Ò»£º
´ò¿ªÆóÒµ¹ÜÀíÆ÷£>SQL SERVRE ×é£>(local)window NT ->ÊôÐÔ
²úÆ·:ÓÐpersonalµÄÊǸöÈË°æµÄ£¬ÓÐEnterpriseµÄÊÇÆóÒµ°æµÄ
²úÆ·°æ±¾£º8.00.2039(sp4);8.00.760(sp3)
·½·¨¶þ£º
µÚÒ»²½£ºÔÚ²éѯ·ÖÎöÆ÷
select @@version
print @@version
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 ......
ÏÈ°ÑÎı¾½øÐиñʽ´¦Àí£¬È»ºóÒÔ¿Õ¸ñΪ·Ö¸ô·û£¬È¡µÚ¶þ¸ö¿Õ¸ñºóµÄ×Ö´®£¬ÅÅÐò£¬È¥ÖØ£¬ÔÙ½µÐòÅÅÁУ¬È¡Ç°5¸ö
arr=($(cat 0100055F_Detail.txt|sed -e '/:/d'|awk -F ' ' '{print$2}'|sort|uniq -c|sort -nr|head -5|awk '{print $2}'))
len=${#arr[@]} »ñÈ¡Êý×鳤¶È
for((i=0;i<$len;i++))
do
echo ${arr[$i] ......
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾ ......