锘??xml version="1.0" encoding="utf-8" standalone="yes"?>精品久久久久久亚洲精品,亚洲精品综合在线影院,亚洲色欲色欲www在线丝http://m.tkk7.com/absolutedo/category/36433.html瀹濆墤閿嬩粠紓ㄧ牶鍑?姊呰姳棣欒嚜鑻﹀瘨鏉ャ?/description>zh-cnSat, 27 Nov 2010 18:24:02 GMTSat, 27 Nov 2010 18:24:02 GMT60ORA-00054:resource busy and acquire with nowait specified(璧勬簮姝e繖錛岄渶鎸囧畾nowait)瑙e喅鏂規(guī)硶http://m.tkk7.com/absolutedo/archive/2010/11/27/339196.htmlioweniowenSat, 27 Nov 2010 06:55:00 GMThttp://m.tkk7.com/absolutedo/archive/2010/11/27/339196.htmlhttp://m.tkk7.com/absolutedo/comments/339196.htmlhttp://m.tkk7.com/absolutedo/archive/2010/11/27/339196.html#Feedback0http://m.tkk7.com/absolutedo/comments/commentRss/339196.htmlhttp://m.tkk7.com/absolutedo/services/trackbacks/339196.html

1> 閫氳繃姝よ鍙ユ煡璇㈡鍦ㄩ攣瀹氱殑SESSION_ID:

1SELECT  SESSION_ID   FROM   V$LOCKED_OBJECT,USER_OBJECTS  WHERE   V$LOCKED_OBJECT.OBJECT_ID   =   USER_OBJECTS.OBJECT_ID


2> 閫氳繃絎竴姝ユ煡璇㈠埌鐨凷ESSION_ID鏌ヨSERIAL#

1SELECT SERIAL# FROM V$SESSION  WHERE SID='12'(姝ゅ'12'涓轟笂闈㈡煡璇㈠埌鐨?/span>'SESSION_ID')


 3> 鏍規(guī)嵁1,2姝ユ煡璇㈠埌鐨凷ESSION_ID鍜孲ERIAL#鎵ц

1ALTER   SYSTEM   KILL   SESSION  '12,154'(12涓篠ESSION_ID鐨勫? 154涓篠ERIAL#鐨勫?

4> 濡傛灉鍒╃敤涓婇潰鐨勫懡浠ゆ潃姝諱竴涓繘紼嬪悗錛岃繘紼嬬姸鎬佽緗負(fù)"killed"錛屼絾鏄攣瀹氱殑璧勬簮寰堥暱鏃墮棿娌℃湁琚噴鏀撅紝閭d箞榪樺彲浠ュ湪os涓綰у啀鏉姝葷浉搴旂殑榪涚▼(綰跨▼)錛岄鍏堟墽琛屼笅闈㈢殑璇彞鑾峰緱褰撳墠榪涚▼(綰跨▼)鐨勬爣紺篜ID錛?br />
1select spid, osuser, s.program 
2from v$session s,v$process p
3where s.paddr=p.addr and s.sid=12 (12鏄笂闈㈢殑SESSION_ID)

鐒跺悗鍦∣S閫氳繃浠誨姟綆$悊鍣ㄦ壘鍒板搴旂殑榪涚▼錛屽湪鏉姝昏繖涓繘紼?綰跨▼)



iowen 2010-11-27 14:55 鍙戣〃璇勮
]]>
瀛樺偍榪囩▼瀛︿範(fàn)-鎵歸噺鎻掑叆10000鏉℃暟鎹繘鏁版嵁搴?/title><link>http://m.tkk7.com/absolutedo/archive/2010/11/27/339194.html</link><dc:creator>iowen</dc:creator><author>iowen</author><pubDate>Sat, 27 Nov 2010 06:41:00 GMT</pubDate><guid>http://m.tkk7.com/absolutedo/archive/2010/11/27/339194.html</guid><wfw:comment>http://m.tkk7.com/absolutedo/comments/339194.html</wfw:comment><comments>http://m.tkk7.com/absolutedo/archive/2010/11/27/339194.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/absolutedo/comments/commentRss/339194.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/absolutedo/services/trackbacks/339194.html</trackback:ping><description><![CDATA[鏈榪戝湪瀛︿範(fàn)瀛樺偍榪囩▼錛屼互鍓嶅湪欏圭洰涓病鏈夋庝箞鎺ヨЕ榪囷紒<br /> <br /> 鎴戦氳繃瀛樺偍榪囩▼鍍忔暟鎹簱涓壒閲忔坊鍔犱竴鍗冧竾(100000000)鏉¤褰?緇撴灉PL/SQL寰堥暱鏃墮棿娌℃湁鍙嶆槧錛岀粨鏋滀笉寰楀凡閫氳繃鑴氭湰鏉鎺夊綋鍓嶈繘紼嬶紝鎴戦噸鏂伴氳繃瀛樺偍榪囩▼鎻掑叆10000鏉℃暟鎹?br /> <br /> 寤鴻〃鑴氭湰錛?br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080"> 1</span><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #008080">--</span><span style="color: #008080">鍒犻櫎鐢ㄦ埛琛?/span><span style="color: #008080"><br /> </span><span style="color: #008080"> 2</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">DROP</span><span style="color: #000000"> </span><span style="color: #0000ff">TABLE</span><span style="color: #000000"> T_PORTAL_USER;<br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><br /> </span><span style="color: #008080"> 4</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #008080">--</span><span style="color: #008080">鍒涘緩鐢ㄦ埛琛?/span><span style="color: #008080"><br /> </span><span style="color: #008080"> 5</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">CREATE</span><span style="color: #000000"> </span><span style="color: #0000ff">TABLE</span><span style="color: #000000"> T_PORTAL_USER<br /> </span><span style="color: #008080"> 6</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />(<br /> </span><span style="color: #008080"> 7</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />    id </span><span style="color: #000000; font-weight: bold">NUMBER</span><span style="color: #000000"> </span><span style="color: #0000ff">PRIMARY</span><span style="color: #000000"> </span><span style="color: #0000ff">KEY</span><span style="color: #000000">, </span><span style="color: #008080">--</span><span style="color: #008080"> 鐢ㄦ埛琛ㄧず</span><span style="color: #008080"><br /> </span><span style="color: #008080"> 8</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">    username </span><span style="color: #000000; font-weight: bold">VARCHAR2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">24</span><span style="color: #000000">) </span><span style="color: #808080">NOT</span><span style="color: #000000"> </span><span style="color: #0000ff">NULL</span><span style="color: #000000">,</span><span style="color: #008080">--</span><span style="color: #008080"> 鐢ㄦ埛鍚?/span><span style="color: #008080"><br /> </span><span style="color: #008080"> 9</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">    password </span><span style="color: #000000; font-weight: bold">VARCHAR2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">24</span><span style="color: #000000">) </span><span style="color: #808080">NOT</span><span style="color: #000000"> </span><span style="color: #0000ff">NULL</span><span style="color: #000000">,</span><span style="color: #008080">--</span><span style="color: #008080"> 瀵嗙爜</span><span style="color: #008080"><br /> </span><span style="color: #008080">10</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">    realname </span><span style="color: #000000; font-weight: bold">VARCHAR2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">24</span><span style="color: #000000">) </span><span style="color: #808080">NOT</span><span style="color: #000000"> </span><span style="color: #0000ff">NULL</span><span style="color: #000000">,</span><span style="color: #008080">--</span><span style="color: #008080"> 鐪熷疄濮撳悕</span><span style="color: #008080"><br /> </span><span style="color: #008080">11</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">    sex </span><span style="color: #000000; font-weight: bold">VARCHAR2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">2</span><span style="color: #000000">) </span><span style="color: #0000ff">DEFAULT</span><span style="color: #000000"> </span><span style="color: #ff0000">'</span><span style="color: #ff0000">0</span><span style="color: #ff0000">'</span><span style="color: #000000">,</span><span style="color: #008080">--</span><span style="color: #008080"> 鎬у埆 "0":Male "1":Female</span><span style="color: #008080"><br /> </span><span style="color: #008080">12</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">    registerDate </span><span style="color: #000000; font-weight: bold">TIMESTAMP</span><span style="color: #000000"> </span><span style="color: #808080">NOT</span><span style="color: #000000"> </span><span style="color: #0000ff">NULL</span><span style="color: #000000">,</span><span style="color: #008080">--</span><span style="color: #008080"> 娉ㄥ唽鏃ユ湡</span><span style="color: #008080"><br /> </span><span style="color: #008080">13</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">    state </span><span style="color: #000000; font-weight: bold">VARCHAR2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">2</span><span style="color: #000000">) </span><span style="color: #808080">NOT</span><span style="color: #000000"> </span><span style="color: #0000ff">NULL</span><span style="color: #000000"> </span><span style="color: #008080">--</span><span style="color: #008080"> 璐﹀彿鐘舵?nbsp;"0":鍚敤  "1":娉ㄩ攢</span><span style="color: #008080"><br /> </span><span style="color: #008080">14</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">)<br /> </span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><br /> </span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #008080">--</span><span style="color: #008080">鍒犻櫎鐢ㄦ埛琛ㄥ簭鍒?/span><span style="color: #008080"><br /> </span><span style="color: #008080">17</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">DROP</span><span style="color: #000000"> SEQUENCE SEQ_T_PORTAL_USER;<br /> </span><span style="color: #008080">18</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><br /> </span><span style="color: #008080">19</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #008080">--</span><span style="color: #008080">鍒涘緩鐢ㄦ埛琛ㄥ簭鍒?/span><span style="color: #008080"><br /> </span><span style="color: #008080">20</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">CREATE</span><span style="color: #000000"> SEQUENCE SEQ_T_PORTAL_USER<br /> </span><span style="color: #008080">21</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />START </span><span style="color: #0000ff">WITH</span><span style="color: #000000"> </span><span style="color: #800000; font-weight: bold">1</span><span style="color: #000000"><br /> </span><span style="color: #008080">22</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />INCREMENT </span><span style="color: #0000ff">BY</span><span style="color: #000000"> </span><span style="color: #800000; font-weight: bold">1</span><span style="color: #000000"><br /> </span><span style="color: #008080">23</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />NOMAXVALUE<br /> </span><span style="color: #008080">24</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />CACHE </span><span style="color: #800000; font-weight: bold">20</span></div> <br /> <br /> -- 鎵歸噺鏂板涓涓囨潯鐢ㄦ埛<br /> <br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080"> 1</span><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #008080">--</span><span style="color: #008080"> 鎵歸噺鏂板涓涓囨潯鐢ㄦ埛</span><span style="color: #008080"><br /> </span><span style="color: #008080"> 2</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">CREATE</span><span style="color: #000000"> </span><span style="color: #808080">OR</span><span style="color: #000000"> </span><span style="color: #ff00ff">REPLACE</span><span style="color: #000000"> </span><span style="color: #0000ff">PROCEDURE</span><span style="color: #000000"> PROC_USER_CREATE_BAT<br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">AS</span><span style="color: #000000"><br /> </span><span style="color: #008080"> 4</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />    startTime </span><span style="color: #000000; font-weight: bold">VARCHAR2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">32</span><span style="color: #000000">);</span><span style="color: #008080">--</span><span style="color: #008080">寮濮嬫椂闂?/span><span style="color: #008080"><br /> </span><span style="color: #008080"> 5</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000">    endTime </span><span style="color: #000000; font-weight: bold">VARCHAR2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">32</span><span style="color: #000000">);</span><span style="color: #008080">--</span><span style="color: #008080">緇撴潫鏃墮棿</span><span style="color: #008080"><br /> </span><span style="color: #008080"> 6</span><span style="color: #008080"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">BEGIN</span><span style="color: #000000"><br /> </span><span style="color: #008080"> 7</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />  </span><span style="color: #0000ff">SELECT</span><span style="color: #000000"> TO_CHAR(SYSDATE,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">yyyy-mm-dd hh24:mi:ss:ff</span><span style="color: #ff0000">'</span><span style="color: #000000">) </span><span style="color: #0000ff">INTO</span><span style="color: #000000"> startTime </span><span style="color: #0000ff">FROM</span><span style="color: #000000"> DUAL;<br /> </span><span style="color: #008080"> 8</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />  DBMS_OUTPUT.PUT_LINE(</span><span style="color: #ff0000">'</span><span style="color: #ff0000">Start Time: </span><span style="color: #ff0000">'</span><span style="color: #808080">||</span><span style="color: #000000">startTime);<br /> </span><span style="color: #008080"> 9</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />  </span><span style="color: #0000ff">FOR</span><span style="color: #000000"> i </span><span style="color: #808080">in</span><span style="color: #000000"> </span><span style="color: #800000; font-weight: bold">1</span><span style="color: #000000">..</span><span style="color: #800000; font-weight: bold">10000</span><span style="color: #000000"> LOOP<br /> </span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />     </span><span style="color: #0000ff">INSERT</span><span style="color: #000000"> </span><span style="color: #0000ff">INTO</span><span style="color: #000000"> T_PORTAL_USER </span><span style="color: #0000ff">VALUES</span><span style="color: #000000">(SEQ_T_PORTAL_USER.NEXTVAL,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">owen</span><span style="color: #ff0000">'</span><span style="color: #808080">||</span><span style="color: #000000">i,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">123456</span><span style="color: #ff0000">'</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">gekunjin</span><span style="color: #ff0000">'</span><span style="color: #808080">||</span><span style="color: #000000">i,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">0</span><span style="color: #ff0000">'</span><span style="color: #000000">,sysdate,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">0</span><span style="color: #ff0000">'</span><span style="color: #000000">);<br /> </span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />  </span><span style="color: #0000ff">END</span><span style="color: #000000"> LOOP;<br /> </span><span style="color: #008080">12</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />  </span><span style="color: #0000ff">SELECT</span><span style="color: #000000"> TO_CHAR(SYSDATE,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">yyyy-mm-dd hh24:mi:ss:ff</span><span style="color: #ff0000">'</span><span style="color: #000000">) </span><span style="color: #0000ff">INTO</span><span style="color: #000000"> endTime </span><span style="color: #0000ff">FROM</span><span style="color: #000000"> DUAL;<br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />  DBMS_OUTPUT.PUT_LINE(</span><span style="color: #ff0000">'</span><span style="color: #ff0000">End Time: </span><span style="color: #ff0000">'</span><span style="color: #808080">||</span><span style="color: #000000">endTime);<br /> </span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">END</span><span style="color: #000000"> PROC_USER_CREATE_BAT;</span></div> <img src ="http://m.tkk7.com/absolutedo/aggbug/339194.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/absolutedo/" target="_blank">iowen</a> 2010-11-27 14:41 <a href="http://m.tkk7.com/absolutedo/archive/2010/11/27/339194.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓閬揝QL闈㈣瘯棰?/title><link>http://m.tkk7.com/absolutedo/archive/2009/08/17/291432.html</link><dc:creator>iowen</dc:creator><author>iowen</author><pubDate>Mon, 17 Aug 2009 02:14:00 GMT</pubDate><guid>http://m.tkk7.com/absolutedo/archive/2009/08/17/291432.html</guid><wfw:comment>http://m.tkk7.com/absolutedo/comments/291432.html</wfw:comment><comments>http://m.tkk7.com/absolutedo/archive/2009/08/17/291432.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/absolutedo/comments/commentRss/291432.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/absolutedo/services/trackbacks/291432.html</trackback:ping><description><![CDATA[鏈夎繖鏍蜂袱涓〃錛?br /> table_a:<br /> <br /> id        name        val <br /> 1          aaa          30 <br /> 2          aaa          40 <br /> 3          aaa          50 <br /> 1          bbb         35 <br /> 2          bbb         45 <br /> 3          bbb         55 <br /> <br /> table_b: <br /> name        val1        val2        val3 <br /> aaa            30          40          50 <br /> bbb           35          45          55 <br /> <br /> 璇風(fēng)敤涓涓猄QL璇彞瀹炵幇table_a鍒皌able_b鐨勮漿鍖栥?br /> <br /> <br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080"> 1</span><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><span style="color: #0000ff">create</span><span style="color: #000000"> </span><span style="color: #0000ff">table</span><span style="color: #000000"> tb(id </span><span style="font-weight: bold; color: #000000">int</span><span style="color: #000000">, name </span><span style="font-weight: bold; color: #000000">varchar</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">10</span><span style="color: #000000">), val </span><span style="font-weight: bold; color: #000000">int</span><span style="color: #000000">)<br /> </span><span style="color: #008080"> 2</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">insert</span><span style="color: #000000"> </span><span style="color: #0000ff">into</span><span style="color: #000000"> tb </span><span style="color: #0000ff">values</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">1</span><span style="color: #000000"> , </span><span style="color: #ff0000">'</span><span style="color: #ff0000">aaa</span><span style="color: #ff0000">'</span><span style="color: #000000"> , </span><span style="font-weight: bold; color: #800000">30</span><span style="color: #000000"> )<br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">insert</span><span style="color: #000000"> </span><span style="color: #0000ff">into</span><span style="color: #000000"> tb </span><span style="color: #0000ff">values</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">2</span><span style="color: #000000"> , </span><span style="color: #ff0000">'</span><span style="color: #ff0000">aaa</span><span style="color: #ff0000">'</span><span style="color: #000000"> , </span><span style="font-weight: bold; color: #800000">40</span><span style="color: #000000"> )<br /> </span><span style="color: #008080"> 4</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">insert</span><span style="color: #000000"> </span><span style="color: #0000ff">into</span><span style="color: #000000"> tb </span><span style="color: #0000ff">values</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">3</span><span style="color: #000000"> , </span><span style="color: #ff0000">'</span><span style="color: #ff0000">aaa</span><span style="color: #ff0000">'</span><span style="color: #000000"> , </span><span style="font-weight: bold; color: #800000">50</span><span style="color: #000000"> )<br /> </span><span style="color: #008080"> 5</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">insert</span><span style="color: #000000"> </span><span style="color: #0000ff">into</span><span style="color: #000000"> tb </span><span style="color: #0000ff">values</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">1</span><span style="color: #000000"> , </span><span style="color: #ff0000">'</span><span style="color: #ff0000">bbb</span><span style="color: #ff0000">'</span><span style="color: #000000"> , </span><span style="font-weight: bold; color: #800000">35</span><span style="color: #000000"> )<br /> </span><span style="color: #008080"> 6</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">insert</span><span style="color: #000000"> </span><span style="color: #0000ff">into</span><span style="color: #000000"> tb </span><span style="color: #0000ff">values</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">2</span><span style="color: #000000"> , </span><span style="color: #ff0000">'</span><span style="color: #ff0000">bbb</span><span style="color: #ff0000">'</span><span style="color: #000000"> , </span><span style="font-weight: bold; color: #800000">45</span><span style="color: #000000"> )<br /> </span><span style="color: #008080"> 7</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">insert</span><span style="color: #000000"> </span><span style="color: #0000ff">into</span><span style="color: #000000"> tb </span><span style="color: #0000ff">values</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">3</span><span style="color: #000000"> , </span><span style="color: #ff0000">'</span><span style="color: #ff0000">bbb</span><span style="color: #ff0000">'</span><span style="color: #000000"> , </span><span style="font-weight: bold; color: #800000">55</span><span style="color: #000000"> )<br /> </span><span style="color: #008080"> 8</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">go</span><span style="color: #000000"><br /> </span><span style="color: #008080"> 9</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> </span><span style="color: #008080">10</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #008080">--</span><span style="color: #008080">sql 2000闈?rùn)鎬侊紝鎸嘔D鍙湁1,2,3</span><span style="color: #008080"><br /> </span><span style="color: #008080">11</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">select</span><span style="color: #000000"> name , <br /> </span><span style="color: #008080">12</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />       </span><span style="color: #ff00ff">sum</span><span style="color: #000000">(</span><span style="color: #ff00ff">case</span><span style="color: #000000"> id </span><span style="color: #0000ff">when</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #800000">1</span><span style="color: #000000"> </span><span style="color: #0000ff">then</span><span style="color: #000000"> val </span><span style="color: #0000ff">else</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #800000">0</span><span style="color: #000000"> </span><span style="color: #0000ff">end</span><span style="color: #000000">) </span><span style="color: #ff0000">[</span><span style="color: #ff0000">val1</span><span style="color: #ff0000">]</span><span style="color: #000000">,<br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />       </span><span style="color: #ff00ff">sum</span><span style="color: #000000">(</span><span style="color: #ff00ff">case</span><span style="color: #000000"> id </span><span style="color: #0000ff">when</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #800000">2</span><span style="color: #000000"> </span><span style="color: #0000ff">then</span><span style="color: #000000"> val </span><span style="color: #0000ff">else</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #800000">0</span><span style="color: #000000"> </span><span style="color: #0000ff">end</span><span style="color: #000000">) </span><span style="color: #ff0000">[</span><span style="color: #ff0000">val2</span><span style="color: #ff0000">]</span><span style="color: #000000">,<br /> </span><span style="color: #008080">14</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />       </span><span style="color: #ff00ff">sum</span><span style="color: #000000">(</span><span style="color: #ff00ff">case</span><span style="color: #000000"> id </span><span style="color: #0000ff">when</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #800000">3</span><span style="color: #000000"> </span><span style="color: #0000ff">then</span><span style="color: #000000"> val </span><span style="color: #0000ff">else</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #800000">0</span><span style="color: #000000"> </span><span style="color: #0000ff">end</span><span style="color: #000000">) </span><span style="color: #ff0000">[</span><span style="color: #ff0000">val3</span><span style="color: #ff0000">]</span><span style="color: #000000"><br /> </span><span style="color: #008080">15</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">from</span><span style="color: #000000"> tb<br /> </span><span style="color: #008080">16</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">group</span><span style="color: #000000"> </span><span style="color: #0000ff">by</span><span style="color: #000000"> name<br /> </span><span style="color: #008080">17</span><span style="color: #000000"><img id="Codehighlighter1_514_705_Open_Image" onclick="this.style.display='none'; Codehighlighter1_514_705_Open_Text.style.display='none'; Codehighlighter1_514_705_Closed_Image.style.display='inline'; Codehighlighter1_514_705_Closed_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_514_705_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_514_705_Closed_Text.style.display='none'; Codehighlighter1_514_705_Open_Image.style.display='inline'; Codehighlighter1_514_705_Open_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /></span><span id="Codehighlighter1_514_705_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/**/</span><span id="Codehighlighter1_514_705_Open_Text"><span style="color: #008080">/*</span><span style="color: #008080"><br /> </span><span style="color: #008080">18</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />name       val1        val2        val3        <br /> </span><span style="color: #008080">19</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />---------- ----------- ----------- ----------- <br /> </span><span style="color: #008080">20</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />aaa        30          40          50<br /> </span><span style="color: #008080">21</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />bbb        35          45          55<br /> </span><span style="color: #008080">22</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> </span><span style="color: #008080">23</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />錛堟墍褰卞搷鐨勮鏁頒負(fù) 2 琛岋級(jí)<br /> </span><span style="color: #008080">24</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" /></span><span style="color: #008080">*/</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">25</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> </span><span style="color: #008080">26</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #008080">--</span><span style="color: #008080">sql 2000鍔ㄦ侊紝鎸嘔D涓嶇‘瀹?/span><span style="color: #008080"><br /> </span><span style="color: #008080">27</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">declare</span><span style="color: #000000"> </span><span style="color: #008000">@sql</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #000000">varchar</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">8000</span><span style="color: #000000">)<br /> </span><span style="color: #008080">28</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">set</span><span style="color: #000000"> </span><span style="color: #008000">@sql</span><span style="color: #000000"> </span><span style="color: #808080">=</span><span style="color: #000000"> </span><span style="color: #ff0000">'</span><span style="color: #ff0000">select name </span><span style="color: #ff0000">'</span><span style="color: #000000"><br /> </span><span style="color: #008080">29</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">select</span><span style="color: #000000"> </span><span style="color: #008000">@sql</span><span style="color: #000000"> </span><span style="color: #808080">=</span><span style="color: #000000"> </span><span style="color: #008000">@sql</span><span style="color: #000000"> </span><span style="color: #808080">+</span><span style="color: #000000"> </span><span style="color: #ff0000">'</span><span style="color: #ff0000"> , sum(case id when </span><span style="color: #ff0000">'''</span><span style="color: #000000"> </span><span style="color: #808080">+</span><span style="color: #000000"> </span><span style="color: #ff00ff">cast</span><span style="color: #000000">(id </span><span style="color: #0000ff">as</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #000000">varchar</span><span style="color: #000000">) </span><span style="color: #808080">+</span><span style="color: #000000"> </span><span style="color: #ff0000">'''</span><span style="color: #ff0000"> then val else 0 end) [val</span><span style="color: #ff0000">'</span><span style="color: #000000"> </span><span style="color: #808080">+</span><span style="color: #000000"> </span><span style="color: #ff00ff">cast</span><span style="color: #000000">(id </span><span style="color: #0000ff">as</span><span style="color: #000000"> </span><span style="font-weight: bold; color: #000000">varchar</span><span style="color: #000000">) </span><span style="color: #808080">+</span><span style="color: #000000"> </span><span style="color: #ff0000">'</span><span style="color: #ff0000">]</span><span style="color: #ff0000">'</span><span style="color: #000000"><br /> </span><span style="color: #008080">30</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">from</span><span style="color: #000000"> (</span><span style="color: #0000ff">select</span><span style="color: #000000"> </span><span style="color: #0000ff">distinct</span><span style="color: #000000"> id </span><span style="color: #0000ff">from</span><span style="color: #000000"> tb) </span><span style="color: #0000ff">as</span><span style="color: #000000"> a<br /> </span><span style="color: #008080">31</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">set</span><span style="color: #000000"> </span><span style="color: #008000">@sql</span><span style="color: #000000"> </span><span style="color: #808080">=</span><span style="color: #000000"> </span><span style="color: #008000">@sql</span><span style="color: #000000"> </span><span style="color: #808080">+</span><span style="color: #000000"> </span><span style="color: #ff0000">'</span><span style="color: #ff0000"> from tb group by name</span><span style="color: #ff0000">'</span><span style="color: #000000"><br /> </span><span style="color: #008080">32</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">exec</span><span style="color: #000000">(</span><span style="color: #008000">@sql</span><span style="color: #000000">) <br /> </span><span style="color: #008080">33</span><span style="color: #000000"><img id="Codehighlighter1_1004_1180_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1004_1180_Open_Text.style.display='none'; Codehighlighter1_1004_1180_Closed_Image.style.display='inline'; Codehighlighter1_1004_1180_Closed_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_1004_1180_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1004_1180_Closed_Text.style.display='none'; Codehighlighter1_1004_1180_Open_Image.style.display='inline'; Codehighlighter1_1004_1180_Open_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /></span><span id="Codehighlighter1_1004_1180_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/**/</span><span id="Codehighlighter1_1004_1180_Open_Text"><span style="color: #008080">/*</span><span style="color: #008080"><br /> </span><span style="color: #008080">34</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />name       val1        val2        val3        <br /> </span><span style="color: #008080">35</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />---------- ----------- ----------- ----------- <br /> </span><span style="color: #008080">36</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />aaa        30          40          50<br /> </span><span style="color: #008080">37</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />bbb        35          45          55<br /> </span><span style="color: #008080">38</span><span style="color: #008080"><img src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" /></span><span style="color: #008080">*/</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">39</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> </span><span style="color: #008080">40</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> </span><span style="color: #008080">41</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">drop</span><span style="color: #000000"> </span><span style="color: #0000ff">table</span><span style="color: #000000"> tb<br /> </span><span style="color: #008080">42</span><span style="color: #000000"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span></div> <br /> <br /> <img src ="http://m.tkk7.com/absolutedo/aggbug/291432.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/absolutedo/" target="_blank">iowen</a> 2009-08-17 10:14 <a href="http://m.tkk7.com/absolutedo/archive/2009/08/17/291432.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>sql涓?with rollup 銆亀ith cube銆乬rouping 緇熻鍑芥暟鐢ㄦ硶 http://m.tkk7.com/absolutedo/archive/2009/08/17/291426.htmlioweniowenMon, 17 Aug 2009 01:51:00 GMThttp://m.tkk7.com/absolutedo/archive/2009/08/17/291426.htmlhttp://m.tkk7.com/absolutedo/comments/291426.htmlhttp://m.tkk7.com/absolutedo/archive/2009/08/17/291426.html#Feedback0http://m.tkk7.com/absolutedo/comments/commentRss/291426.htmlhttp://m.tkk7.com/absolutedo/services/trackbacks/291426.htmlSQL code
with rollup 銆?/span>with cube銆?/span>grouping CUBE 鍜?ROLLUP 涔嬮棿鐨勫尯鍒湪浜庯細(xì) CUBE 鐢熸垚鐨勭粨鏋滈泦鏄劇ず浜?jiǎn)鎵閫夊垪涓肩殑鎵鏈夌粍鍚堢殑鑱氬悎銆? ROLLUP 鐢熸垚鐨勭粨鏋滈泦鏄劇ず浜?jiǎn)鎵閫夊垪涓肩殑鏌愪竴灞傛緇撴瀯鐨勮仛鍚堛? grouping: 褰撶敤 CUBE 鎴?ROLLUP 榪愮畻絎︽坊鍔犺鏃訛紝闄勫姞鐨勫垪杈撳嚭鍊間負(fù)1錛屽綋鎵娣誨姞鐨勮涓嶆槸鐢?CUBE 鎴?ROLLUP 浜х敓鏃訛紝闄勫姞鍒楀間負(fù)0銆? --渚嬪 DECLARE @T TABLE(鍚嶇О VARCHAR(1) , 鍑虹増鍟?VARCHAR(10), 浠鋒牸1 INT, 浠鋒牸2 INT) INSERT @T SELECT 'a', '鍖椾含', 11, 22 UNION ALL SELECT 'a', '鍥涘窛', 22, 33 UNION ALL SELECT 'b', '鍥涘窛', 12, 23 UNION ALL SELECT 'b', '鍖椾含', 10, 20 UNION ALL SELECT 'b', '鏄嗘槑', 20, 30 SELECT 鍚嶇О, 鍑虹増鍟? SUM(浠鋒牸1) AS 浠鋒牸1, SUM(浠鋒牸2) AS 浠鋒牸2, GROUPING(鍚嶇О) AS CHECK鍚嶇О, GROUPING(鍑虹増鍟? AS CHECK鍑虹増鍟? FROM @T GROUP BY 鍚嶇О,鍑虹増鍟?WITH CUBE /* 鍚嶇О 鍑虹増鍟? 浠鋒牸1 浠鋒牸2 CHECK鍚嶇О CHECK鍑虹増鍟? ---- ---------- ----------- ----------- ------- -------- a 鍖椾含 11 22 0 0 a 鍥涘窛 22 33 0 0 a NULL 33 55 0 1 b 鍖椾含 10 20 0 0 b 鏄嗘槑 20 30 0 0 b 鍥涘窛 12 23 0 0 b NULL 42 73 0 1 NULL NULL 75 128 1 1 NULL 鍖椾含 21 42 1 0 NULL 鏄嗘槑 20 30 1 0 NULL 鍥涘窛 34 56 1 0 錛堟墍褰卞搷鐨勮鏁頒負(fù) 11 琛岋級(jí) */ --鍒嗘瀽 /*group by 涓ゅ垪錛氬悕縐版湁涓や釜綾誨埆A,B;鎵鏈夌敱CUBE榪愮畻鑰岀敓鎴愯鐨勬槸 鍚嶇О 鍑虹増鍟? 浠鋒牸1 浠鋒牸2 CHECK鍚嶇О CHECK鍑虹増鍟? ---- ---------- ----------- ----------- ------- -------- a NULL 33 55 0 1 b NULL 42 73 0 1 鍑虹増鍟嗘湁涓変釜綾誨埆錛屾墍鏈夌敱CUBE榪愮畻鑰岀敓鎴愯鐨勬槸 鍚嶇О 鍑虹増鍟? 浠鋒牸1 浠鋒牸2 CHECK鍚嶇О CHECK鍑虹増鍟? ---- ---------- ----------- ----------- ------- -------- NULL 鍖椾含 21 42 1 0 NULL 鏄嗘槑 20 30 1 0 NULL 鍥涘窛 34 56 1 0 浠ュ強(qiáng) NULL NULL 75 128 1 1 */ SELECT 鍚嶇О, 鍑虹増鍟? SUM(浠鋒牸1) AS 浠鋒牸1, SUM(浠鋒牸2) AS 浠鋒牸2 FROM @T GROUP BY 鍚嶇О,鍑虹増鍟?WITH ROLLUP /* 鍚嶇О 鍑虹増鍟? 浠鋒牸1 浠鋒牸2 ---- ---------- ----------- ----------- a 鍖椾含 11 22 a 鍥涘窛 22 33 a NULL 33 55 b 鍖椾含 10 20 b 鏄嗘槑 20 30 b 鍥涘窛 12 23 b NULL 42 73 NULL NULL 75 128 */


iowen 2009-08-17 09:51 鍙戣〃璇勮
]]>
鍏充簬GUID鐢熸垚鍑芥暟鐨勪笉鍚屾暟鎹簱闂寸殑鏀寔[Reship]http://m.tkk7.com/absolutedo/archive/2009/06/03/279861.htmlioweniowenWed, 03 Jun 2009 09:40:00 GMThttp://m.tkk7.com/absolutedo/archive/2009/06/03/279861.htmlhttp://m.tkk7.com/absolutedo/comments/279861.htmlhttp://m.tkk7.com/absolutedo/archive/2009/06/03/279861.html#Feedback0http://m.tkk7.com/absolutedo/comments/commentRss/279861.htmlhttp://m.tkk7.com/absolutedo/services/trackbacks/279861.html
/*
渚嬪瓙:
declare @i uniqueidentifier
select @i=newid()
begin
 print cast(@i as varchar(50))
end
*/

2:Oracle涓紝鏈塖YS_GUID鍑芥暟錛岃繑鍥炴暟鎹被鍨嬩負(fù)char錛岄暱搴︿負(fù)32銆?br /> /*
select sys_guid() from dual
*/

DB2涓紝娌℃湁浜х敓GUID鐨勫嚱鏁幫紝鏈変竴鏇夸唬鐨勫嚱鏁癵enerate_unique錛岃繑鍥炵殑鏁版嵁綾誨瀷涓篊HAR FOR BIT錛岄暱搴︿負(fù)13銆?br />
SYBASE涓紝涔熸湁NEWID()鍑芥暟錛岃繑鍥炵殑鏁版嵁綾誨瀷涓篶har錛岄暱搴︿負(fù)36銆?br />
璇勮堪錛孏UID鍦ㄤ繚璇佹暟鎹褰昉rimary Key鍞竴鎬э紝浣滅敤寰堝ぇ錛孌B2涓嶆敮鎸佽繖涓鍑芥暟錛屽晢鐢ㄤ富嫻佹暟鎹簱涓紝DB2鏈宸侻S SQL Server榪樻湁鐩存帴鏀寔GUID鐨勬暟鎹被鍨嬶紝鏀寔鏈濂姐係YBASE鐨勬枃妗d綔寰楁渶宸紝鍦ㄥ叾鏂囨。涓棤娉曟煡鍒癗EWID鍑芥暟錛屼絾鏄彲浠ヤ嬌鐢ㄣ?br />

杞嚦:http://www.cnblogs.com/jobs/archive/2004/07/26/27533.html

iowen 2009-06-03 17:40 鍙戣〃璇勮
]]>
鏁版嵁搴撳涔? ORA-12545:鍥犵洰鏍囦富鏈烘垨瀵硅薄涓嶅瓨鍦紝榪炴帴澶辮觸http://m.tkk7.com/absolutedo/archive/2009/02/09/253856.htmlioweniowenMon, 09 Feb 2009 02:16:00 GMThttp://m.tkk7.com/absolutedo/archive/2009/02/09/253856.htmlhttp://m.tkk7.com/absolutedo/comments/253856.htmlhttp://m.tkk7.com/absolutedo/archive/2009/02/09/253856.html#Feedback4http://m.tkk7.com/absolutedo/comments/commentRss/253856.htmlhttp://m.tkk7.com/absolutedo/services/trackbacks/253856.html1.鎼滅儲(chǔ)oracle瀹夎鐩綍錛屾壘鍒拌繖淇╀釜鏂囦歡 tnsnames.ora 鍜?listener.ora 錛岃繕鏈変竴涓ぇ鍐欑殑TNSNAMES.ORA涓嶇敤綆″畠銆備粬浠殑璺緞濡備笅錛氬 鐩樼:\oracle\ora92\network\admin  浠栦滑鍦ㄥ悓涓涓洰褰曢噷錛岀紪杈戣繖淇╀釜鏂囦歡錛屾妸閲岄潰鐨凥ost= 鐨勫湴鏂規(guī)敼涓轟綘鐨勮綆楁満鍚嶅氨琛屼簡(jiǎn)銆?娉ㄦ剰鏈夊涓紝鐪嬩粩緇嗕簡(jiǎn)銆?font color="#ff0000">鎴栬呮敼鎴怚P,涓嬫鏀逛簡(jiǎn)IP娉ㄦ剰鍐嶄慨鏀硅緇熶竴)

2.濡傛灉榪欐椂鐧婚檰鐨勮瘽錛岃偗瀹氫細(xì)鎻愮ず浣犳病鏈夌洃鍚櫒錛岄偅鏄洃鍚殑鏈嶅姟娌℃湁寮錛屽埌璁$畻鏈虹殑鏈嶅姟閭h繘鍏ユ湇鍔$殑鏂規(guī)硶錛氭帶鍒墮潰鏉?銆夌鐞嗗伐鍏?銆夋湇鍔★紙淇╀釜榻胯疆鐨勯偅涓浘鏍囷級(jí)錛岀劧鍚庢壘鍒癘racleOraHome92TNSListener榪欎釜鏈嶅姟錛屾妸瀹冨惎鍔ㄤ簡(jiǎn)錛屽氨濂戒簡(jiǎn)銆?/p>

iowen 2009-02-09 10:16 鍙戣〃璇勮
]]>
SQLServer SQL鍒嗛〉璇彞http://m.tkk7.com/absolutedo/archive/2008/12/03/244141.htmlioweniowenWed, 03 Dec 2008 08:00:00 GMThttp://m.tkk7.com/absolutedo/archive/2008/12/03/244141.htmlhttp://m.tkk7.com/absolutedo/comments/244141.htmlhttp://m.tkk7.com/absolutedo/archive/2008/12/03/244141.html#Feedback0http://m.tkk7.com/absolutedo/comments/commentRss/244141.htmlhttp://m.tkk7.com/absolutedo/services/trackbacks/244141.htmlHere i take jobs table of pubs databse for example,details as follow: 

select top eachpage *  from  jobs where job_id not in ( select top (eachpage*(currentpage-1))  job_id from jobs order by job_id desc)) order by job_id desc;

explain:
1. eachpage : the number of each page show the recorder
2.currentpage: current page

notice:
the red line in the sentence,you should take care of it, because Microsoft SQLServer  TOP Function can't support the expression .it can only support a number.
so before you prepare to buildup the sql sentence ,you should alread calculate the result of the expression about (eachpage*(currentpage-1))  .

Example:
set  eachpage=3
      currentpage=5
 so  (eachpage*(currentpage-1)) =12
select top 3 * from jobs where (job_id not in (select top 12 job_id from jobs order by job_id desc)) order by job_id desc




iowen 2008-12-03 16:00 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 久久精品亚洲日本波多野结衣| 精品亚洲成a人片在线观看| 亚洲精品精华液一区二区| 日本免费网站视频www区| 亚洲一区二区影院| 在线成人爽a毛片免费软件| 亚洲AV无码国产在丝袜线观看| 伊人免费在线观看| 亚洲精品卡2卡3卡4卡5卡区| 福利免费在线观看| 亚洲av无码专区国产乱码在线观看| 国产啪精品视频网站免费尤物| 亚洲日韩精品一区二区三区| 99精品视频免费| 亚洲精品白浆高清久久久久久| 水蜜桃视频在线观看免费播放高清 | 亚洲高清中文字幕免费| 亚洲人妖女同在线播放| 国产高清免费观看| 青青草国产免费国产是公开| 亚洲综合色自拍一区| 免费在线中文日本| 亚洲成AV人综合在线观看| 成全视频在线观看免费高清动漫视频下载 | 久久九九兔免费精品6| 亚洲午夜精品国产电影在线观看| 久久久久久久免费视频| 色五月五月丁香亚洲综合网| 中文字幕日韩亚洲| 59pao成国产成视频永久免费| 亚洲欧美第一成人网站7777 | 亚洲一区二区三区偷拍女厕| 一级毛片在线免费看| 久久亚洲国产最新网站| 亚洲av无码成人精品区| 成人网站免费看黄A站视频| 亚洲六月丁香婷婷综合| 亚洲中文字幕视频国产| 久久久久久曰本AV免费免费| 国产大陆亚洲精品国产| 亚洲av午夜福利精品一区人妖|