ÇÉÓÃSQL ServerÈÕÆÚÀàÐÍÊý¾Ý¶þ½øÖÆÊä³ö¼ÆËãʱ¼ä²î
1¡¢SQL ServerÈÕÆÚÊý¾Ý¿âÄÚ²¿±íʾ¼°²éѯÊä³ö£º
SQL ServerÄÚ²¿¶ÔDateTimeÀàÐ͵ıíʾÊÇÓÃ8¸ö×Ö½ÚÀ´±íʾ£¬ÆäÖÐÇ°4¸ö×Ö½Ú±íʾµÄÊýֵΪ×Ô1900Äê1ÔÂ1ÈÕÁãʱÒÔÀ´µÄÌìÊý£¬ºóËĸö×Ö½ÚÊÇÌìÊýÖ®ÍâµÄÓжàÉÙ¸ö1/300Ã룬ÕâҲ˵Ã÷SQL ServerÄÚ²¿±íʾʱ¼äµÄ¾«¶ÈΪ1/300Ã룬Լ3.3ºÁÃë¡£
³£¹æµÄSQL²éѯ£¬Õý³£ÈÕÆÚÊä³ö¸ñʽΪ:yyyy-MM-dd hh:mm:ss.SSS£¬ÕâÒ²ÊÇÖÐÎIJÙ×÷ϵͳµÄÈÕÆÚ¸ñʽ£¬¿ÉÒÔͨ¹ýÐ޸IJÙ×÷ϵͳÈÕÆÚ±í´ï¸ñʽÀ´Ó°ÏìSQL ServerȱʡµÄÈÕÆÚÊä³ö¸ñʽ¡£µ«ÊÇ£¬ÓÐЩʱºòȱʡµÄÈÕÆÚÊä³ö¸ñʽ²¢²»ÊÇÎÒÃÇÐèÒªµÄ£¬ÌرðÊÇ»ùÓÚʱ¼ä²îµÄÓ¦ÓÃÐèÇó¡£
2¡¢Ó¦ÓÃÐèÇó£º
»ùÓÚһϵÁÐʱ¼äµãµÄÊý¾Ý¼Ç¼·ÖÎö¡¢Í³¼ÆijÖÖ½á¹û¡£±ÈÈçGPS¶¨Î»É豸°´Ò»¶¨Ê±¼ä¼ä¸ô»Ø´«Î»ÖÃÊý¾Ý²¢¼Ç¼µ½Êý¾Ý¿âÖУ¬Êý¾Ý°üÀ¨¾Î³¶È¡¢Ê±¼ä¡¢Ëٶȵȣ¬ÏÖÔÚÐèÒª»ùÓÚÕâЩ»Ø´«Êý¾Ýͳ¼ÆÊÇ·ñÔÚijµØÓÐÍ£Áô£¬Í£Áôʱ¼ä¡¢¿ªÊ¼Ê±¼ä¡¢½áÊøʱ¼ä¡£Í£Áô±êÖ¾ÊÇËÙ¶ÈΪ0¡£ÏÔʾ£¬ÕâÐèÒª¸ù¾ÝÊý¾Ý¼Ç¼֮¼äµÄ²îÖµ×öͳ¼Æ¼ÆËã¡£
3¡¢ÊʺÏÐèÇóµÄÊä³ö¼°×ª»»¡¢´¦Àí£º
Èç¹û°´ÕÕȱʡµÄSQL ServerÈÕÆÚÊä³ö¸ñʽ£¬Êä³öÄÚÈÝ¿ÉÓ³ÉäΪ±à³ÌÓïÑÔÏà¹ØµÄÊý¾ÝÀàÐÍ£¬ÈçJava¿ÉÒÔÊÇString¡¢Date£¬×ªÎªÎªDateÓÐÒ»¶¨Í³¼ÆÊý¾ÝÁ¿µÄ»°£¬Õâ¸öת»»±¾Éí¾ÍÊǵÍЧºÍºÄʱµÄ£¬Êµ¼Ê¹ý³Ì¿ÉÄÜÊÇÏÈ´ÓSQL ServerÄÚ²¿±íʾת»»Îªyyyy-MM-dd hh:mm:ss.SSS×Ö·û´®£¬ÔÙ´ÓÕâ¸ö×Ö·û´®×ª»»ÎªDate£»×÷ΪStringʹÓÃÒ²ÐèҪת»»ÎªDateÖ®ºó²Å¿ÉÒÔ×öʱ¼ä²îÔËË㣬ͬÑùµÍЧ¡£
SQL ServerÄÚ²¿Êý¾Ý±íʾ¸ñʽÆäʵÒѾÊʺϱí´ïʱ¼ä²îÁË£¬ÊDz»ÊÇÄÜÖ±½ÓÀûÓá£SQL ServerÓÐcastº¯Êý£¬¿ÉÒÔ½«ÈÕÆÚÊä³öΪ¶þ½øÖÆÊý¾Ý¡£È磺
select longi, lati, speed, cast(gpsDate as binary(8)) as gpsDate from loc_history
ºóÐø´¦Àí´úÂëƬ¶ÎΪ£º
float lon = rs.getFloat("longi");
float lat = rs.getFloat("lati");
byte time[] = rs.getBytes("gpsDate");
»ñµÃ¾Î³¶È¡¢Ê±¼ä¶þ½øÖƱíʾ
int days = ((time[0] & 0x00ff) << 24) + ((time[1] & 0x00ff) << 16)
+ ((time[2] & 0x00ff) << 8) + (time[3] & 0x00ff);
int seconds = ((time[4] & 0x00ff) << 24) + ((time[5] & 0x00ff) << 16)
+ ((time[6] & 0x00f
Ïà¹ØÎĵµ£º
select 1 from ...£¬ sqlÓï¾äÖеÄ1´ú±íʲôÒâ˼£¿²é³öÀ´ÊǸöʲô½á¹û£¿
select 1 from table;Óëselect anycol(Ä¿µÄ±í¼¯ºÏÖеÄÈÎÒâÒ»ÐУ© from table;Óëselect * from table ´Ó×÷ÓÃÉÏÀ´ËµÊÇûÓвî±ðµÄ£¬¶¼ÊDz鿴ÊÇ·ñÓмǼ£¬Ò»°ãÊÇ×÷Ìõ¼þ²éѯÓõġ£select 1 from Ö ......
ÓÐÕâÑùÒ»¸ö×Ö·û´®(ÖÐ,¹ú,ÖÐ,ÈËÃñ,¹ú,ÏÖ´ú¹¤Òµ»¯½ø³Ì,¹ú)
´¦Àí¹ýÖ®ºó±ä³É(ÖÐ,¹ú,ÈËÃñ,ÏÖ´ú¹¤Òµ»¯½ø³Ì)
ÒÔÏÂÊÇÎҵķ½·¨,ÓÐʲô²»¶ÔµÄµØ·½»¹Çë¸÷λָµã
------------------ɾ³ýÖظ´µÄ×Ö·û
declare
@v1 nvarchar
......
SQL SERVER2000´ò²¹¶¡ÎÊÌâ»ã×Ü ¡¾http://hi.baidu.com/yanhai/blog/item/cf67c2ce07a9f50992457e9d.html¡¿
SQL ServerµÄ²¹¶¡°æ±¾¼ì²é²»ÈçWindows ²¹¶¡°æ±¾¼ì²éÖ±½Ó£¬Ò»¸öϵͳ¹ÜÀíÔ±£¬Èç¹û²»Á˽âSQL Server°æ±¾¶ÔÓ¦µÄ²¹¶¡ºÅ£¬¿ÉÄÜÒ²»áÓöµ½Ò»µãÂé·³£¬Òò´ËÔÚÕâ˵Ã÷һϣ¬Í¨¹ýÕâÑùµÄ°ì·¨Åбð»úÆ÷ÊÇ°²È«µÄ°ì·¨£¬²»»á¶Ôϵͳ²úÉúÈ ......
£Ó£Ñ£Ì Óï·¨²Î¿¼ÊÖ²á(SQL)/Êý¾ÝÀàÐÍ
DB2 ÌṩÁ˹ØÁ¬Ê½×ÊÁÏ¿âµÄ²éѯÓïÑÔ £Ó£Ñ£Ì (Structured Query Language)£¬ÊÇÒ»Öַdz£¿ÚÓﻯ¡¢¼ÈÒ×ѧÓÖÒ׶®µÄÓï·¨¡£´ËÒ»ÓïÑÔ¼¸ºõÊÇÿ¸ö×ÊÁÏ¿âϵͳ¶¼±ØÐëÌṩµÄ£¬ÓÃÒÔ±íʾ¹ØÁ¬Ê½µÄ*×÷£¬°üº¬ÁË×ÊÁϵĶ¨Ò壨£Ä£Ä£Ì£©ÒÔ¼°×ÊÁϵĴ¦Àí£¨£Ä£Í£Ì£©¡£SQLÔÀ´Æ´³ÉS ......
ºÍÆäËü³ÌÐòÒ»Ñù£¬SSIS°üͬÑùÐèÒª½¡×³£¬Îȶ¨µÄÔËÐУ¬ÕâÑùµÄ³ÌÐò²ÅÓпɿ¿ÐԺͿÉÉìËõÐÔ¡£SSISÌṩÁËÈçÏ·½ÃæµÄÖ§³Ö:
1.ÊÂÎñ: ¿ÉÒÔ¶ÔÒ»¸ö³ÌÐò°üÉèÖóÉÒ»¸ö»òÕ߶à¸öÊÂÎñ£¬ÉõÖÁ¿ÉÒÔ¶ÔÁ½¸ö³ÌÐò°üÉèÖóÉÒ»¸öÊÂÎñ¡£ÎªÁ˱£Ö¤Êý¾ÝµÄÒ»ÖÂÐÔ£¬Ä㻹¿ÉÒÔDTCÊÂÎñ»òÕßSQL ServerÒýÇ漶µÄÊÂÎñ¡£ ......