锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲AV成人噜噜无码网站,亚洲美女色在线欧洲美女,亚洲色欲或者高潮影院http://www.tkk7.com/junky/category/18619.htmlzh-cnFri, 13 Jul 2007 10:38:23 GMTFri, 13 Jul 2007 10:38:23 GMT60SQL SERVER 鍏充簬澶栬仈鎺?Outer Join)鍙婂叾浠?/title><link>http://www.tkk7.com/junky/archive/2007/07/12/129852.html</link><dc:creator>junky</dc:creator><author>junky</author><pubDate>Thu, 12 Jul 2007 07:44:00 GMT</pubDate><guid>http://www.tkk7.com/junky/archive/2007/07/12/129852.html</guid><wfw:comment>http://www.tkk7.com/junky/comments/129852.html</wfw:comment><comments>http://www.tkk7.com/junky/archive/2007/07/12/129852.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/junky/comments/commentRss/129852.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/junky/services/trackbacks/129852.html</trackback:ping><description><![CDATA[<p><strong>涓 浣跨敤澶栬仈鎺?/strong></p> <p>銆銆浠ュ墠鍦∣racle涓敤=(+)鍜?+)=鏉ヨ繘琛屽乏澶栬仈鎺ュ拰鍙沖鑱旀帴錛涘悗鏉ョ敤SQL Server鏃剁敤*=鍜?*榪涜澶栬繛鎺ュ乏澶栬仈鎺ュ拰鍙沖鑱旀帴錛?br>鐜板湪鍐沖畾鐢⊿QL-92鐨勬爣鍑嗘柟娉曪細[OUTER] JOIN錛孫UTER鏄彲浠ョ渷鐣ョ殑銆?/p> <p>銆銆LEFT OUTER JOIN 鎴?nbsp;LEFT JOIN        琛ㄧず宸﹀鑱旀帴 </p> <p>銆銆RIGHT OUTER JOIN 鎴?nbsp;RIGHT JOIN   琛ㄧず宸﹀鑱旀帴 </p> <p>銆銆FULL OUTER JOIN 鎴?nbsp;FULL JOIN        琛ㄧず宸﹀鑱旀帴</p> <p>銆銆澶栬仈鎺ョ殑鎰忔濅笉鐢ㄥ璇達紝鎴戜滑閮芥噦錛屼絾鏄疛OIN鍒板簳鎬庝箞鐢ㄥ憿錛熸病鏈夋壘鍒板緢濂界殑璧勬枡錛屽彧鑳戒粠渚嬪瓙涓涔犱簡錛?/p> <p>銆銆1銆佽繖涓緥瀛愪篃璁告病鏈夊疄闄呮剰涔夛紝鍙槸涓轟簡璇存槑闂錛?/p> <div style="SCROLLBAR-HIGHLIGHT-COLOR: buttonhighlight; OVERFLOW: auto; WIDTH: 500px"> <pre style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: black 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: black 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #ededed"> <div><span style="COLOR: #000000">CREATE TABLE orders(order_id </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, firm_id </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, p_id </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) CREATE TABLE firms (firm_id </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, f_name </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) CREATE TABLE products(p_id </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, p_name </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) select a.order_id, b.f_name, c.p_name from orders a left join firms b on a.firm_id </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> b.firm_id left join products c on a.p_id </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> c.p_id</span></div> </pre> </div> <p>銆銆璇存槑錛歰rders琛ㄦ槸涓昏〃錛屽厛鍜屼粠琛╢irms榪涜宸﹁仈鎺ワ紝鍐嶅拰浠庤〃products榪涜宸﹁仈鎺ャ?/p> <p>銆銆鍒ゆ柇鏄鑱旀帴涓殑涓昏〃榪樻槸浠庤〃涓昏鐪媐rom浠庡彞涓悇涓〃鍦↙EFT JOIN鎴朢IGHT JOIN涓よ竟鐨勪綅緗細LEFT JOIN宸﹁竟鐨勮〃鏄富琛紝RIGHT JOIN鍙寵竟鐨勮〃鏄富琛紱</p> <p>銆銆ON琛ㄨ揪浜嗕袱涓〃榪炴帴鐨勬潯浠訛紝涓鑸鑱旀帴鏄瓑鍊艱仈鎺ワ紝涓嶇瓑鍊艱仈鎺ユ剰涔変笉澶э紱</p> <p>銆銆鍦ㄥ涓〃鐨勮繛鎺ヤ腑錛屼竴涓〃鏃㈠彲浠ュ仛涓昏〃鍙堝悓鏃跺彲浠ュ仛浠庤〃錛屼負浜嗚鏄庤繖涓棶棰橈紝鎴戜滑淇敼浠ヤ笂SQL涓猴細</p> <div style="SCROLLBAR-HIGHLIGHT-COLOR: buttonhighlight; OVERFLOW: auto; WIDTH: 500px"> <pre style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: black 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: black 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #ededed"> <div><span style="COLOR: #000000">select a.order_id, b.f_name, c.p_name from orders a left join firms b on a.firm_id </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> b.firm_id right join products c on a.order_id </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> c.p_id</span></div> </pre> </div> <p>銆銆榪欎釜SQL娌℃湁浠涔堟剰涔夛紝浣嗕粠涓彲浠ョ湅鍑篴琛ㄦ棦鏄痓鐨勪富琛ㄥ張鏄痗鐨勪粠琛紱鍒板簳鎬庝箞鐢紝榪樻槸瑕佹牴鎹疄闄呮儏鍐墊潵鍐沖畾鏄乏鑱旀帴榪樻槸鍙寵仈鎺ワ紱</p> <p>銆銆閭eぉ錛岀湅鍒頒簡榪欐牱涓涓緥瀛愶細</p> <div style="SCROLLBAR-HIGHLIGHT-COLOR: buttonhighlight; OVERFLOW: auto; WIDTH: 500px"> <pre style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: black 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: black 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #ededed"> <div><span style="COLOR: #000000">create table tab1 (c1 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c2 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c3 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) create table tab2 (c1 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c2 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c3 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) create table tab3 (c1 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c2 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c3 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) create table tab4 (c1 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c2 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">, c3 </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) SELECT </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> FROM tab1 LEFT OUTER JOIN tab2 ON tab1.c3 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab2.c3 left OUTER JOIN tab3 right OUTER JOIN tab4 ON tab3.c1 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab4.c1 ON tab2.c3 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab4.c3</span></div> </pre> </div> <p>銆銆榪欑鐢ㄦ硶榪樼湡灝戣錛屽叿浣撴庝箞涓剰鎬濓紝榪樺湪鐞嗚В涓?..鎴戞妸瀹冩敼鍐欐垚錛?/p> <div style="SCROLLBAR-HIGHLIGHT-COLOR: buttonhighlight; OVERFLOW: auto; WIDTH: 500px"> <pre style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: black 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: black 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #ededed"> <div><span style="COLOR: #000000">SELECT </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> FROM tab1 left JOIN tab2 ON tab1.c3 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab2.c3 LEFT OUTER JOIN tab4 ON tab2.c3 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab4.c3 RIGHT OUTER JOIN tab3  ON tab3.c1 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab4.c1</span></div> </pre> </div> <p>銆銆涔熻瀹冧滑鏄竴涓剰鎬濄傛垜鍙戠幇鍔犱釜鎷彿錛岀湅鐨勬洿娓呮涓浜涳紙瀹冩槸涓祵濂楋級</p> <div style="SCROLLBAR-HIGHLIGHT-COLOR: buttonhighlight; OVERFLOW: auto; WIDTH: 500px"> <pre style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: black 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: black 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #ededed"> <div><span style="COLOR: #000000">SELECT </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> FROM tab1 LEFT OUTER JOIN tab2 ON tab1.c3 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab2.c3 left OUTER JOIN (tab3 right OUTER JOIN tab4 ON tab3.c1 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab4.c1) ON tab2.c3 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tab4.c3</span></div> </pre> </div> <p>銆銆<strong>浜?nbsp;澶栬仈鎺ヤ腑 "ON + AND" 涓?nbsp;"ON + WHERE" 鐨勫尯鍒?/strong></p> <p>銆銆1銆乷n鏉′歡鏄鑱旀帴鏃跺湪鐢熸垚涓存椂琛ㄦ椂浣跨敤鐨勮仈緇撴潯浠訛紝涓嶈浠庤〃鏄‘瀹氬艱繕鏄疦ULL錛屼富琛ㄦ墍鏈夌殑鍊奸兘浼氬嚭鐜幫紱</p> <p>銆銆濡傛灉鍐嶅姞涓奱nd鏉′歡錛?nbsp;濡傛灉and鏉′歡寮曠敤鐨勬槸涓昏〃鐨勫垪錛屽垯瀵圭粨鏋滄鏃犲獎鍝嶏紝涓昏〃鐨勬墍鏈夌邯褰曚緷鐒朵細鍏ㄩ儴鍑虹幇錛涘鏋渁nd鏉′歡寮曠敤鐨勬槸浠庤〃鐨勫垪錛屽垯涓嶇鍚堟潯浠剁殑浠庤〃綰綍鏄劇ずNULL錛?/p> <p>銆銆2銆亀here鏉′歡鏄湪涓存椂琛ㄧ敓鎴愬悗錛屽啀瀵逛復鏃惰〃榪涜榪囨護鐨勬潯浠躲備復鏃惰〃涓殑鎵鏈夌邯褰曢兘鍙楀獎鍝嶏紝涓嶇鍚堟潯浠剁殑綰綍琚繃婊ゅ嚭緇撴灉闆嗭紱</p> <p>銆銆3銆佺ず渚嬶細</p> <div style="SCROLLBAR-HIGHLIGHT-COLOR: buttonhighlight; OVERFLOW: auto; WIDTH: 500px"> <pre style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: black 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: black 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #ededed"> <div><span style="COLOR: #000000">select a.module_id, a.name, b.module_name from fb_autocoding a left join fb_app_module b on a.module_id </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> b.module_id and b.module_internal_label </span><span style="COLOR: #000000"><></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">LO</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">; select a.module_id, a.name, b.module_name from fb_autocoding a left join fb_app_module b on a.module_id </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> b.module_id where b.module_internal_label </span><span style="COLOR: #000000"><></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">LO</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">; </span></div> </pre> </div> <p>銆銆<strong>涓?nbsp;鍏朵粬Join榪愮畻</strong></p> <p>銆銆merge join錛氬湪澶勭悊鍏朵粬鑱旂粨涔嬪墠錛屽厛鎶婄浉鍏充袱涓〃鑱旂粨鍦ㄤ竴璧鳳紱</p> <p>銆銆hash join錛氭妸涓涓〃join鍒板凡緇忚鎵ц榪噅oin鐨勭粨鏋滀笂錛?/p> <p>銆銆鐢ㄦ嫭鍙鋒敼鍙榡oin鐨勯『搴忥細</p> <div style="SCROLLBAR-HIGHLIGHT-COLOR: buttonhighlight; OVERFLOW: auto; WIDTH: 500px"> <pre style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: black 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: black 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #ededed"> <div><span style="COLOR: #000000">select catalog.item, catalog.item_color, product.item, color.color_name from catalog full outer join (product cross join color) on catalog.item </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> product.item and catalog.item_color </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> color.color_name;</span></div> </pre> </div> <div style="DISPLAY: none">1</div> <img src ="http://www.tkk7.com/junky/aggbug/129852.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/junky/" target="_blank">junky</a> 2007-07-12 15:44 <a href="http://www.tkk7.com/junky/archive/2007/07/12/129852.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍒╃敤 JdbcTemplate 鑷姩榪斿洖 MS SQL SERVER 2005 鑷涓婚敭鍊?/title><link>http://www.tkk7.com/junky/archive/2007/07/11/129604.html</link><dc:creator>junky</dc:creator><author>junky</author><pubDate>Wed, 11 Jul 2007 05:54:00 GMT</pubDate><guid>http://www.tkk7.com/junky/archive/2007/07/11/129604.html</guid><wfw:comment>http://www.tkk7.com/junky/comments/129604.html</wfw:comment><comments>http://www.tkk7.com/junky/archive/2007/07/11/129604.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/junky/comments/commentRss/129604.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/junky/services/trackbacks/129604.html</trackback:ping><description><![CDATA[JDBC3 涓彲浠ョ洿鎺ヨ幏鍙栧綋鍓嶆彃鍏ヨ褰曠殑 ID 鍊鹼紝鍏蜂綋鐨勮皟鐢ㄦ柟寮忓涓嬶細<br><br> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: rgb(230,230,230) 0% 50%; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 95%; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid; moz-background-clip: -moz-initial; moz-background-origin: -moz-initial; moz-background-inline-policy: -moz-initial"> <div><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align=top><span style="COLOR: rgb(0,0,0)">Statement stmt </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> conn.createStatement();<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align=top>stmt.executeUpdate(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">INSERT INTO authors (first_name, last_name) values<br> (′George′, ′Orwell′)</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">, Statement.RETURN_GENERATED_KEYS);<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align=top>ResultSet rs </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> stmt.getGeneratedKeys();<br><img id=_226_252_Open_Image onclick="this.style.display='none'; document.getElementById('_226_252_Open_Text').style.display='none'; document.getElementById('_226_252_Closed_Image').style.display='inline'; document.getElementById('_226_252_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=_226_252_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_226_252_Closed_Text').style.display='none'; document.getElementById('_226_252_Open_Image').style.display='inline'; document.getElementById('_226_252_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: rgb(0,0,255)">if</span><span style="COLOR: rgb(0,0,0)"> ( rs.next() ) </span><span id=_226_252_Closed_Text style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)">...</span><span id=_226_252_Open_Text><span style="COLOR: rgb(0,0,0)">{<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: rgb(0,0,255)">int</span><span style="COLOR: rgb(0,0,0)"> key </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> rs.getInt();<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div> </div> <br>鐢變簬瀹為檯涓庢暟鎹簱浜や簰閲囩敤鐨勬槸 JdbcTemplate錛屽洜鑰岄渶瑕佹壘鍒板畠瀵硅繖縐嶆柟寮忕殑鏀寔銆傜粡榪囧疄闄呯殑鏌ョ湅 Spring 鐨?API 鍙戠幇鍏舵湰韜彁渚涚浉搴旂殑鏂規硶鏀寔錛岀粡榪囧嬈$殑瀹為獙鍚庡緱鍒板涓嬬殑瀹炵幇鏂規硶錛?br><br> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: rgb(230,230,230) 0% 50%; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 95%; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid; moz-background-clip: -moz-initial; moz-background-origin: -moz-initial; moz-background-inline-policy: -moz-initial"> <div><img id=_42_848_Open_Image onclick="this.style.display='none'; document.getElementById('_42_848_Open_Text').style.display='none'; document.getElementById('_42_848_Closed_Image').style.display='inline'; document.getElementById('_42_848_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=_42_848_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_42_848_Closed_Text').style.display='none'; document.getElementById('_42_848_Open_Image').style.display='inline'; document.getElementById('_42_848_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align=top><span style="COLOR: rgb(0,0,255)">private</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">void</span><span style="COLOR: rgb(0,0,0)"> insert(</span><span style="COLOR: rgb(0,0,255)">final</span><span style="COLOR: rgb(0,0,0)"> Profile profile)</span><span id=_42_848_Closed_Text style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)">...</span><span id=_42_848_Open_Text><span style="COLOR: rgb(0,0,0)">{<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: rgb(0,0,255)">final</span><span style="COLOR: rgb(0,0,0)"> String _save </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">insert into Newsletter_Profile (user_id, publication_id, last_update) values (?, ?, getdate())</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">;<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>    JdbcTemplate template </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.getJdbcTemplate();<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>    KeyHolder keyHolder </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> GeneratedKeyHolder();<br><img id=_310_769_Open_Image onclick="this.style.display='none'; document.getElementById('_310_769_Open_Text').style.display='none'; document.getElementById('_310_769_Closed_Image').style.display='inline'; document.getElementById('_310_769_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=_310_769_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_310_769_Closed_Text').style.display='none'; document.getElementById('_310_769_Open_Image').style.display='inline'; document.getElementById('_310_769_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align=top>    template.update(</span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> PreparedStatementCreator() </span><span id=_310_769_Closed_Text style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)">...</span><span id=_310_769_Open_Text><span style="COLOR: rgb(0,0,0)">{<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: rgb(0,0,255)">public</span><span style="COLOR: rgb(0,0,0)"> PreparedStatement createPreparedStatement(Connection con)<br><img id=_402_755_Open_Image onclick="this.style.display='none'; document.getElementById('_402_755_Open_Text').style.display='none'; document.getElementById('_402_755_Closed_Image').style.display='inline'; document.getElementById('_402_755_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=_402_755_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_402_755_Closed_Text').style.display='none'; document.getElementById('_402_755_Open_Image').style.display='inline'; document.getElementById('_402_755_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align=top>         </span><span style="COLOR: rgb(0,0,255)">throws</span><span style="COLOR: rgb(0,0,0)"> SQLException </span><span id=_402_755_Closed_Text style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)">...</span><span id=_402_755_Open_Text><span style="COLOR: rgb(0,0,0)">{<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>                        </span><span style="COLOR: rgb(0,0,255)">int</span><span style="COLOR: rgb(0,0,0)"> i </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,0)">0</span><span style="COLOR: rgb(0,0,0)">;<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>                        PreparedStatement ps </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> con.prepareStatement(_save,<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>             <span style="BACKGROUND-COLOR: rgb(255,255,0)">Statement.RETURN_GENERATED_KEYS</span>);<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>                        ps.setInt(</span><span style="COLOR: rgb(0,0,0)">++</span><span style="COLOR: rgb(0,0,0)">i, profile.getCustomerId().intValue());<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>                        ps.setInt(</span><span style="COLOR: rgb(0,0,0)">++</span><span style="COLOR: rgb(0,0,0)">i, profile.getPublication().getId());<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>                        </span><span style="COLOR: rgb(0,0,255)">return</span><span style="COLOR: rgb(0,0,0)"> ps;<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                  }</span></span><span style="COLOR: rgb(0,0,0)"><br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>            }</span></span><span style="COLOR: rgb(0,0,0)">, keyHolder);<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align=top>            profile.setId(keyHolder.getKey().intValue());<br><img alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align=top>      }</span></span><span style="COLOR: rgb(0,0,0)"> </span></div> </div> <br>鐗瑰埆闇瑕佹敞鎰忕殑鍦版柟鏄?span id=_42_848_Open_Text><span id=_310_769_Open_Text><span id=_402_755_Open_Text><span style="COLOR: rgb(0,0,0)"><span style="BACKGROUND-COLOR: rgb(255,255,0)">Statement.RETURN_GENERATED_KEYS</span></span></span></span></span>錛屽湪浣跨敤MS SQL Server 2005 鎻愪緵鐨?JDBC Driver 涓笂闈㈢殑閮ㄥ垎鏄繀欏葷殑銆備箣鎵浠ヨ繖涔堣鏄洜涓?google 鍑烘潵鐨勬墍鏈夎祫鏂欓兘鏄病鏈夎閮ㄥ垎鐨勶紝鐢氳嚦 Spring 鑷韓鐨?document 涓篃鏄病鏈夎鍙傛暟鐨勩傛垜鐜板湪涓嶇煡閬撻偅浜涗唬鐮佹槸鍚﹁兘澶熺湡姝g殑鑾峰彇鍒?Key錛屼絾鏄幇鍦ㄦ垜 suppose 瀹冧滑鏄彲浠?run 鐨勩?br><br>濡傛灉娌℃湁鍔犲叆 <span id=_42_848_Open_Text><span id=_310_769_Open_Text><span id=_402_755_Open_Text><span style="COLOR: rgb(0,0,0)"><span style="BACKGROUND-COLOR: rgb(255,255,0)">Statement.RETURN_GENERATED_KEYS  </span></span></span></span></span>錛屽湪瀹為檯榪涜鏁版嵁搴撴搷浣滄椂浼氬嚭鐜板涓嬬殑寮傚父錛?br>PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; The statement must be executed before any results can be obtained.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The statement must be executed before any results can be obtained.<br>caused by : com.microsoft.sqlserver.jdbc.SQLServerException: The statement must be executed before any results can be obtained.<br><span>org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; The statement must be executed before any results can be obtained.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The statement must be executed before any results can be obtained. </span><br>Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The statement must be executed before any results can be obtained. <br>at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source) <br>at com.microsoft.sqlserver.jdbc.SQLServerStatement.getGeneratedKeys(Unknown Source) <br>at weblogic.jdbc.wrapper.PreparedStatement_com_microsoft_sqlserver_jdbc_SQLServerPreparedStatement.getGeneratedKeys(Unknown Source) <br>at org.springframework.jdbc.core.JdbcTemplate$3.doInPreparedStatement(JdbcTemplate.java:772) <br>at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:527) <br>at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:767) <br>at com.fdc.reports20.dao.NewsletterDAO.insert(NewsletterDAO.java:179) <br>at com.fdc.reports20.dao.NewsletterDAO.save(NewsletterDAO.java:153) <br>at com.fdc.reports20.dao.NewsletterDAO.update(NewsletterDAO.java:138) <br>at com.fdc.reports20.business.service.user.AlertServiceImpl.updateNewsletter(AlertServiceImpl.java:146) <br>at com.fdc.reports20.business.service.user.AlertServiceImpl$$FastClassByCGLIB$$52b80fbc.invoke() <br>at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) <br>at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:674) <br>at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154) <br>at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:52) <br>at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) <br>at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53) <br>at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) <br>at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) <br>at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) <br>at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) <br>at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) <br>at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:615) <br>at com.fdc.reports20.business.service.user.AlertServiceImpl$$EnhancerByCGLIB$$a12ee5d8.updateNewsletter() <br>at com.fdc.reports20.web.delegate.AlertBD.updateNewsletter(AlertBD.java:78) <br>at com.fdc.reports20.web.jpf.um.workbench.WorkBenchController.editPublicationEmails(WorkBenchController.java:149) <br>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br><span id=_42_848_Open_Text><span id=_310_769_Open_Text><span id=_402_755_Open_Text><span style="COLOR: rgb(0,0,0)"><span style="BACKGROUND-COLOR: rgb(255,255,0)"></span></span></span></span><br></span> <img src ="http://www.tkk7.com/junky/aggbug/129604.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/junky/" target="_blank">junky</a> 2007-07-11 13:54 <a href="http://www.tkk7.com/junky/archive/2007/07/11/129604.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍓嶈Е鍙戝櫒鍜屽悗瑙﹀彂鍣ㄧ畝浠?downmoon)http://www.tkk7.com/junky/archive/2007/06/19/125047.htmljunkyjunkyTue, 19 Jun 2007 01:35:00 GMThttp://www.tkk7.com/junky/archive/2007/06/19/125047.htmlhttp://www.tkk7.com/junky/comments/125047.htmlhttp://www.tkk7.com/junky/archive/2007/06/19/125047.html#Feedback0http://www.tkk7.com/junky/comments/commentRss/125047.htmlhttp://www.tkk7.com/junky/services/trackbacks/125047.html鍓嶈Е鍙戝櫒鍜屽悗瑙﹀彂鍣ㄧ畝浠?downmoon)

    瑙﹀彂鍣ㄦ槸涓縐嶇壒孌婄殑瀛樺偍榪囩▼銆傚綋Insert Update 鎴栬匘elete 璇彞淇敼琛ㄤ腑涓涓垨鑰呭涓鏃舵墽琛岃Е鍙戝櫒銆傚洜涓篠QL Server 瀵圭壒瀹氳〃涓婄殑姣忎竴涓寚瀹氭搷浣滆皟鐢ㄤ竴涓Е鍙戝櫒錛屾墍浠ュ彲浠ヤ嬌鐢ㄨЕ鍙戝櫒鎵╁睍SQL Sever 鐨勫唴緗畬鏁存у拰鏁版嵁鎿嶇旱鍔熻兘.
    娉ㄦ剰:涓嶅儚Delete 璇彞錛孴rancate Table 璇彞涓嶆縺媧昏Е鍙戝櫒錛學rite Text 璇彞涔熶笉嬋媧昏Е鍙戝櫒銆?/span>
    鍦⊿QL Sever 2000 涓敮鎸佷袱縐嶇被鍨嬬殑瑙﹀彂鍣紝鍓嶈Е鍙戝櫒(Instead Of Trigger)鍜屽悗瑙﹀彂鍣?After Trigger)銆傚墠瑙﹀彂鍣ㄥ氨鏄湪璇彞鎵ц涔嬪墠嬋媧昏Е鍙戝櫒錛岃屽悗瑙﹀彂鍣ㄥ氨鏄湪璇彞鎵ц涔嬪悗嬋媧昏Е鍙戝櫒銆傚彲浠ラ氳繃FOR 瀛愬彞鏉ラ夋嫨浣跨敤浣曠瑙﹀彂鍣ㄣ?br>    褰撲負姣忎竴縐嶆搷浣滃垱寤轟竴涓Е鍙戝櫒鏃訛紝鍙互涓烘墍鏈変笁縐嶆搷浣滃垱寤轟竴涓Е鍙戝櫒錛屽茍涓斾嬌鐢ㄧ浉搴旂殑緙栫▼鎶鏈鐞嗘瘡涓縐嶆搷浣溿備笅闈㈢殑紺轟緥鍦‵or 瀛愬彞涓垪鍑轟簡涓夌璇彞綾誨瀷騫訛紝涓斾嬌鐢ㄦ潯浠惰鍙ュ皢鐩稿簲鐨勮窡韙兼彃鍏ュ埌CustUpdLog 琛ㄤ腑銆?br>

Create Trigger TrackCustomerUpdates
On AppDta.dbo.Customer
For Insert,Update,Delete
As
Declare @InsertedCount Int
Declare @DeletedCount Int
Set @InsertedCount=(Select Count(*)From inserted)
Set @DeletedCount=(Select Count(*)From deleted)
If ( @InsertedCount>0)Begin
Insert Into AppDta.dbo.CustUpdLog
( CustID,
Action,
UpdUser,
UpdDateTime)
Select CustId,
Case
When@DeletedCount>0)Then
'Update'
Else 'Insert'
End,
Current_User,
Current_TimeStamp
From inserted
End
Else If(@DeletedCount>0)Begin
Insert Into AppDta.dbo.CustUpdLog
( CustId,
Action,
UpdUser,
UpdDateTime)
select CustId,
'Delete',
Current_User,
Current_TimeStamp
From deleted
End


    姝e鏈緥鎵紺猴紝鏃犺浣曟椂Insert 鎴栬匲pdate 璇彞褰卞搷涓涓垨鑰呭琛屾椂錛宨nserted 涓存椂琛ㄩ兘鏈夎褰曡銆傛棤璁轟綍鏃禗elete 鎴栬匲pdate 璇彞褰卞搷涓涓垨鑰呭琛屾椂錛宒eleted 涓存椂琛ㄩ兘鏈夎褰曡銆傚浜庝竴涓猆pdate 璇彞錛宒eleted 涓存椂琛ㄦ湁鏃ц錛宨nserted 涓存椂琛ㄦ湁鏂拌銆傝繖涓ず渚嬭繕鍙嶆槧浜嗚Е鍙戝櫒鐨勫彟涓涓噸瑕佹柟闈細瀵逛簬鏌愪釜琛ㄧ殑Update 鎴栬匘elete 鎿嶄綔錛屽嵆浣胯璇彞娌℃湁褰卞搷鍒拌錛屼篃嬋媧昏Е鍙戝櫒 (涔熷氨鏄娌℃湁婊¤凍Where 瀛愬彞鐨勮)銆?瑙﹀彂鍣ㄧ殑瀛樺偍榪囩▼搴旇棰勬祴榪欑鍙兘鎬с?/span>


    涓嶄粎鍙互涓轟竴涓〃鍒涘緩澶氫釜瑙﹀彂鍣紝鑰屼笖榪樺彲浠ヤ負涓涓〃鐨勫悓涓涓猄QL 璇彞(渚嬪Update 璇彞)鍒涘緩澶氫釜鍚庤Е鍙戝櫒錛屼笉鑳戒負鍚屼竴涓猄QL 璇彞鍒涘緩澶氫釜鍓嶈Е鍙戝櫒銆傛瘡涓涓柊鐨凜reate Trigger 璇彞澧炲姞瑙﹀彂鍣ㄥ埌閭d簺鎸囧畾琛ㄥ拰璇彞宸叉湁鐨勮Е鍙戝櫒涓傚浜庢墍鍒涘緩鐨勫涓Е鍙戝櫒錛屽彲浠ョ敤緋葷粺瀛樺偍榪囩▼sp_settriggerorder 鏉ユ寚瀹氱涓涓嬋媧葷殑瑙﹀彂鍣ㄥ拰鏈鍚庝竴涓嬋媧葷殑瑙﹀彂鍣紝鑰屽浜庡叾浠栫殑瑙﹀彂鍣紝鍒欎笉鑳芥寚瀹氬叾嬋媧婚『搴忥紝鍙兘鐢辯郴緇熷喅瀹氥傝繖縐嶈Е鍙戝櫒鐨勭壒寰佷笉浼氬紩璧蜂換浣曠壒孌婄殑闂銆傚洜涓烘繪槸鍙互瀹炵幇鍚勭鍔ㄤ綔浣滀負姝e父鐨勫瓨鍌ㄨ繃紼嬶紝騫朵笖鎸夌収瑕佹眰鐨勯『搴忎粠涓涓Е鍙戝櫒涓皟鐢ㄥ畠浠?br>
    灝界瑙﹀彂鍣ㄦ槸涓縐嶅瓨鍌ㄨ繃紼嬶紝浣嗘槸涓嶈兘浣跨敤Execute 璇彞璋冪敤瀹?/span>錛屽鏋滄湁甯屾湜鍏變韓瑙﹀彂鍣ㄥ拰姝e父鐨勫瓨鍌ㄨ繃紼嬬殑緙栫爜錛岄偅涔堝彧闇鎶婂叡浜唬鐮佹斁鍦ㄥ瓨鍌ㄨ繃紼嬩腑錛屼粠瑙﹀彂鍣ㄤ腑璋冪敤瀹冦傚鏋滀竴涓Е鍙戝櫒淇敼涓涓〃錛岄偅涔堣繖浜涗慨鏀瑰彲鑳戒細嬋媧誨彟涓涓Е鍙戝櫒錛屾垨鑰呮湰韜傚湪榛樿鎯呭喌涓嬶紝SQL Sever 鍏佽榪欑宓屽鐨勮Е鍙戝櫒璋冪敤娣卞害涓?2灞傘傝櫧鐒舵垜浠緩璁厑璁稿祵濂楃殑鍜屽彔浠g殑瑙﹀彂鍣紝浣嗘槸鍙互浣跨敤緋葷粺瀛樺偍榪囩▼紱佹榪欎箞鍋氥備笅闈㈢殑璇彞鍦ㄦ寚瀹氱殑鏁版嵁搴撲笂闃叉鍙犱唬瑙﹀彂鍣細
sp_dboption AppDta,`recursive triggers',`false'
    涓轟簡鍦ㄦ墍鏈夋暟鎹簱涓槻姝㈠祵濂楄Е鍙戝櫒璋冪敤(鍖呮嫭鍙犱唬璋冪敤)錛屽彲浠ヤ嬌鐢ㄤ笅闈㈢殑璇彞錛?br>sp_configure `nested triggers',0

    鍓嶉潰浠ュ悗瑙﹀彂鍣ㄤ負渚嬩粙緇嶄簡瑙﹀彂鍣ㄧ殑鍩烘湰鍐呭錛屼笅闈㈠啀浠嬬粛涓涓嬪墠瑙﹀彂鍣ㄧ殑涓嶅悓涔嬪銆?span style="COLOR: rgb(255,0,0)">瑕佸垱寤轟竴涓墠瑙﹀彂鍣ㄥ繀欏葷敤Instead Of 鏄懼紡澹版槑
錛屽涓嬮潰鐨勪緥瀛愶細

create Trigger TrackCustomerUpdates
On AppDta.dbo.Customer
Instead 
Of Update
As
Insert Into AppDta.dbo.CustUpdLog
(CustId,
Action,
UpdUser,
UpdDateTime)
Select CustId,
Update’,
Current_User,
Current_TimeStamp
From inserted


    涓庡悗瑙﹀彂鍣ㄤ笉鍚岀殑鏄細鍓嶈Е鍙戝櫒鏃㈠彲浠ュ湪琛ㄥ張鍙互鍦ㄨ鍥句笂鍒涘緩錛屼絾涓鏉¤鍙ュ彧鑳藉垱寤轟竴涓墠瑙﹀彂鍣紝鍥犳錛屽墠瑙﹀彂鍣ㄤ笉瀛樺湪嬋媧婚『搴忛棶棰?br>

瑙﹀彂鍣ㄥ簲鐢ㄤ婦渚嬶細浠庡綋鍓嶆暟鎹簱鏈嶅姟鍣ㄧ殑Shop琛↖nsert鎿嶄綔鍚屾鍒板彟涓鍙版湇鍔″櫒鐨凷hop銆?br>

CREATE TRIGGER Trigger_SynShopForInsert1
ON dbo.Shop
FOR INSERT
AS
  
insert into OtherServer.dbo.shop
(
lngShopID,strShopCode,strName,strShopName,strDescription,lngIndex
)
select  lngShopID,strShopCode,strName,strShopName,strDescription,lngIndex
from shop where lngShopID in (select lngshopid from inserted)


鎴栬咃細

CREATE TRIGGER Trigger_SynShopForInsert2
ON dbo.Shop
FOR INSERT
AS
  
insert into OtherServer.dbo.shop
(
lngShopID,strShopCode,strName,strShopName,strDescription,lngIndex
)
select  lngShopID,strShopCode,strName,strShopName,strDescription,lngIndex
from  inserted



junky 2007-06-19 09:35 鍙戣〃璇勮
]]>
榪炴帴SQL Server鏃舵姤鐨勫紓甯鎬箣澶勭悊姝ラhttp://www.tkk7.com/junky/archive/2006/12/22/89406.htmljunkyjunkyFri, 22 Dec 2006 01:06:00 GMThttp://www.tkk7.com/junky/archive/2006/12/22/89406.htmlhttp://www.tkk7.com/junky/comments/89406.htmlhttp://www.tkk7.com/junky/archive/2006/12/22/89406.html#Feedback0http://www.tkk7.com/junky/comments/commentRss/89406.htmlhttp://www.tkk7.com/junky/services/trackbacks/89406.html
聽聽

See 聽com.borland.dx.dataset.DataSetException 聽error 聽code: 聽 聽BASE+66 聽
solaris
com.borland.dx.dataset.DataSetException: 聽[Microsoft][SQLServer 聽2000 聽Driver 聽for 聽JDBC]Error 聽establishing 聽socket. 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.dx.dataset.DataSetException.a(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.dx.dataset.DataSetException.throwException(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.dx.dataset.DataSetException.SQLException(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.dx.sql.dataset.Database.openConnection(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.jdbcx.metadata.DatabaseInfo.openConnection(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.jdbcx.metadata.e.run(Unknown 聽Source) 聽

Chained 聽exception: 聽

java.sql.SQLException: 聽[Microsoft][SQLServer 聽2000 聽Driver 聽for 聽JDBC]Error 聽establishing 聽socket. 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.base.BaseExceptions.createException(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.base.BaseExceptions.getException(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.base.BaseExceptions.getException(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.base.BaseConnection.open(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.microsoft.jdbc.base.BaseDriver.connect(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽java.sql.DriverManager.getConnection(DriverManager.java:512) 聽

聽聽 聽聽 聽聽 聽聽at 聽java.sql.DriverManager.getConnection(DriverManager.java:171) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.dx.sql.dataset.Database.openConnection(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.jdbcx.metadata.DatabaseInfo.openConnection(Unknown 聽Source) 聽

聽聽 聽聽 聽聽 聽聽at 聽com.borland.jdbcx.metadata.e.run(Unknown 聽Source) 聽

鏄粈涔堝師鍥犲晩錛?聽
--------------------------------------------------------------- 聽

1銆佷笅杞組icrosoft 聽SQL 聽Server 聽2000 聽Service 聽Pack 聽3a騫跺畨瑁咃紝SQL璇烽夌敤娣峰拰瀹夎妯″紡錛侊紒錛?聽
http://www.microsoft.com/downloads/details.aspx?FamilyId=90DCD52C-0488-4E46-AFBF-ACACE5369FA3&displaylang=zh-cn聽聽
聽聽 瑙e帇緙﹕p3鐨勫崌綰у寘鍚?榪樿鐐瑰嚮setup瀹夎.鎵嶈兘鎴愬姛鍗囩駭鍒皊p3聽聽


2銆佷笅杞絊QL 聽Server 聽2000 聽Driver 聽for 聽JDBC 聽Service 聽Pack 聽3 聽
http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en 聽

3銆佽繍琛屾椂鍏抽棴闃茬伀澧?br />



junky 2006-12-22 09:06 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 好吊妞在线成人免费| 又大又硬又爽又粗又快的视频免费| 18禁超污无遮挡无码免费网站国产| 亚洲一卡二卡三卡四卡无卡麻豆| 中文字幕乱码免费视频| 亚洲综合一区二区精品久久| 四虎免费影院ww4164h| 亚洲精品人成网在线播放影院| 一个人免费观看在线视频www| 亚洲色无码专区一区| 国产真人无遮挡作爱免费视频| 在线观看亚洲专区| 国产aⅴ无码专区亚洲av麻豆 | 九九视频高清视频免费观看| 久久亚洲中文字幕精品一区四 | fc2成年免费共享视频网站| 亚洲视频一区二区| 久久九九全国免费| 亚洲乱码在线播放| 国产免费观看黄AV片| 二个人看的www免费视频| 久久精品蜜芽亚洲国产AV| 黄色成人网站免费无码av| 直接进入免费看黄的网站| 亚洲男同帅GAY片在线观看| 永久在线免费观看| 美女尿口扒开图片免费| 亚洲精品夜夜夜妓女网| 无人在线观看免费高清视频| 深夜a级毛片免费视频| 无码久久精品国产亚洲Av影片| 毛片免费观看网址| 人与动性xxxxx免费| 亚洲视频在线观看网站| 免费看国产一级片| 亚州免费一级毛片| 乱淫片免费影院观看| 久久精品国产亚洲AV蜜臀色欲 | 日本最新免费网站| 免费无码国产V片在线观看| 亚洲欧洲精品国产区|