<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1197963725021640715</id><updated>2012-02-17T11:44:35.907+08:00</updated><category term='VB Script'/><category term='BitComet'/><category term='安全性'/><category term='WORD'/><category term='DTS'/><category term='EXCEL'/><category term='JSP'/><category term='SQL Server Denali'/><category term='SQL Server'/><category term='LogParser'/><category term='SQL Server 2005'/><category term='ASP'/><category term='VB.NET'/><category term='查詢優化'/><category term='Windows'/><category term='IIS'/><category term='SSMS'/><category term='Photoshop'/><category term='Tomcat'/><category term='Websphere'/><category term='SMTP'/><category term='SQL 2012(RC)'/><category term='SSAS'/><category term='SSRS'/><category term='系統錯誤'/><category term='Batch'/><category term='資安'/><category term='DBA'/><category term='IE'/><category term='SQL Server 2008 R2'/><category term='VNC'/><category term='JavaScript'/><category term='TortoiseSVN'/><category term='SSIS'/><title type='text'>adalf的小技巧</title><subtitle type='html'>分享我工作上的小小心得，希望對大家所幫助</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default?start-index=101&amp;max-results=100'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>119</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6771657093680385229</id><published>2012-02-15T21:41:00.000+08:00</published><updated>2012-02-16T14:55:38.160+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Batch'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>WEVTUTIL-管理事件檢視器的工具</title><summary type='text'>
WEVTUTIL 是一個很強大的管理事件檢視器的工具，參數有夠多的，適用於Windows 7、 Windows Server 2008、Windows Server 2008 R2及Windows Vista，拿來清事件檢視器的紀錄超方便，舉幾個我用到的例子吧

1.列出所有log名稱
WEVTUTIL EL




2.列出[工作排程器]的LOG資訊(大小，筆數...)　　
WEVTUTIL GLI Microsoft-Windows-TaskScheduler/Operational 




　3.讀取[工作排程器]事件，此例是以文字格式列出最新的一筆紀錄
WEVTUTIL QE Microsoft-Windows-TaskScheduler/Operational /c:1 /rd:true /f:text






4.清除[工作排程器]事件　
WEVTUTIL CL </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6771657093680385229/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2012/02/wevtutil.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6771657093680385229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6771657093680385229'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2012/02/wevtutil.html' title='WEVTUTIL-管理事件檢視器的工具'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-XtgQzRc4NY4/Tzyc15tcoDI/AAAAAAAAAYs/zl9icvJf_zM/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-356314017225776396</id><published>2012-02-06T22:05:00.000+08:00</published><updated>2012-02-06T22:06:51.068+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>TCP 提供者: 一次只能用一個通訊端位址 (通訊協定/網路位址/連接埠)。</title><summary type='text'>
 　　公司不過一千多人，為何年底那天內網IIS瞬間可看到一萬多個Requests呢？





那是因為內網首頁程式有Bug，上線人數只要一多，Requests就消化不了，這樣Request數也可以飆到一萬多，真的很誇張

有Bug的ASP程式簡寫如下

                                Call AAA


Function
AAA

set rsA = Connection1.Execute(sqlA) 

do while not rsA.eof

                                      Function BBB

loop

End
Function



Function
BBB

set rsA = Connection1.Execute(sqlB) 

do while not rsA.eof

... 
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/356314017225776396/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2012/02/tcp.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/356314017225776396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/356314017225776396'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2012/02/tcp.html' title='TCP 提供者: 一次只能用一個通訊端位址 (通訊協定/網路位址/連接埠)。'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-wmZ2Hz6gIN0/TxOIYFLOMdI/AAAAAAAAAWs/4smF6_yIN18/s72-c/2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5707383551487265097</id><published>2012-01-20T23:10:00.001+08:00</published><updated>2012-01-20T23:19:05.808+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>在Windows Server 2008 R2上將Tomcat安裝成服務的方法</title><summary type='text'>
　　在Windows Server 2008 R2要把Tomcat安裝成服務時，不知為什遭遇到很多問題，可我花了好一番功夫才解決呢，特將安裝步驟與遭遇的問題整理如下囉，供大家參考

　　除OS外的相關軟體

Tomcat使用免安裝版(apache-tomcat-5.5.33)
Jdk也請裝x64(jdk-1_5_0_15-windows-amd64) 


一、先裝Jdk與Tomcat吧，安裝完Jdk後，記得要去環境變數設JAVA_HOME

二、移至tomcat\bin目錄，將 tomcat5.exe 重新命名為 tomcat5.exe.32

三、從tomcat\bin\x64目錄中，將 tomcat5.exe 覆蓋到 tomcat\bin目錄下

 　　我看有人會去下列網址下載 x64的tomcat5.exe也是可以的，我自己測試過拿6.x的裝在5.x的也沒問題喔


http:</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5707383551487265097/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2012/01/windows-server-2008-r2tomcat.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5707383551487265097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5707383551487265097'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2012/01/windows-server-2008-r2tomcat.html' title='在Windows Server 2008 R2上將Tomcat安裝成服務的方法'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-bjPK7ucm2c0/TxkjSdebenI/AAAAAAAAAXU/FbYOrS1t2-g/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2146684711680191529</id><published>2012-01-15T16:15:00.000+08:00</published><updated>2012-01-18T15:51:06.941+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>查看Windows版本-Winver</title><summary type='text'>簡單到不能簡單的問題，但花了我好一番功夫才找到！所以記錄一下以免忘記。  

　　同事裝了一台Windows Server 2008 R2的VM給我測試，但我覺得不像是R2，可是我從[我的電腦]按右鍵選[內容]卻看不出是什版本，如下圖，Windows Server Stansard是什版本啊? 



 　　因為上圖跟我自己裝的Windows Server 2008 x32的看起來幾乎一樣啊，只是同事裝的是x64沒錯，想說有什指令可以查呢？後來上網搜尋了好一會，才找個Winver這指令啊！直接在命令列下執行即可！查看版本很方便。





 　　原來同事裝錯版本給我了．．．

後來在2008 R2的我的電腦資訊中可看出完整版本資訊，可以很明顯的辨識是2008 R2，但不知為什2008的就沒顯示呢？





之後才又發現原來Taskmgr[工作管理員]-&gt;Help[說明]-&gt;About[</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2146684711680191529/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2012/01/windows-winver.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2146684711680191529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2146684711680191529'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2012/01/windows-winver.html' title='查看Windows版本-Winver'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-HqKbJtFtT6Y/TxUngVa2zwI/AAAAAAAAAW0/g-DKpeficaw/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1124710369668486297</id><published>2012-01-08T21:27:00.000+08:00</published><updated>2012-01-12T08:48:16.448+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2012(RC)'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='查詢優化'/><title type='text'>[查詢優化]影響執行計畫的因素3-Cardinality(基數)</title><summary type='text'> 　　基數是用來量測滿足某個條件下的資料列數目，想像一下，如果一個員工資料表總共有500筆資料，這個資料表有單位、姓名及ID等欄位，有一個查詢的條件是"WHERE 單位 = '資訊處' "，那查詢最佳化工具就會找[單位]的統計資料，結果發現直方圖為[資訊處]有50筆，這50筆就是所謂的基數

　　有沒有覺得這個基數很熟悉，沒錯，在執行計畫裡，我們可以把每個運算子的估計的資料列數目當作是基數喔


　　有時查詢最佳化工具沒法正確的預估基數，使得執行計畫的成本估計不正確，會導致選擇次佳的執行計畫呢

　　BOL查詢效能不佳的疑難排解：基數估計裡提到，查詢最佳化工具根據兩個主要因數來判斷執行查詢計畫的成本，基數就是其中的一個因數喔



　　如果改善基數，便能產生更好的估計成本，進而可有更快的執行計畫。





　　這麼重要的基數，難道不值得花一點時間來了解一下呢！</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1124710369668486297/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2012/01/3-cardinality.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1124710369668486297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1124710369668486297'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2012/01/3-cardinality.html' title='[查詢優化]影響執行計畫的因素3-Cardinality(基數)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-4pSqp8Drt3U/Tw1C0y0vKLI/AAAAAAAAAVU/AzSfwciGnYI/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6635300783886926277</id><published>2011-12-11T16:11:00.006+08:00</published><updated>2011-12-12T14:19:06.157+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2012(RC)'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='查詢優化'/><title type='text'>[查詢優化]影響執行計畫的因素2-Density(密度)</title><summary type='text'> 　　上篇介紹了述詞，本篇接著介紹另一個影響執行計畫的因素-Density(密度)，密度是用來描述欄位其重複值發生的頻率，密度介於０到１之間，欄位密度愈高代表唯一值的數量愈少，在既定的查詢下會回傳愈多的資料

公式如右：　　Density(密度) = 平均重複筆數/總筆數

也就是如右圖：

最後上下抵銷掉就是：　　Density(密度) = 1 / 唯一鍵值的筆數
而寫成SQL有兩種算式SELECT 1.0　/　COUNT(*) FROM (SELECT DISTINCT &lt;ColumnName&gt; FROM &lt;TableName&gt;)　t 
SELECT 1.0 / COUNT(DISTINCT &lt;ColumnName&gt;) FROM &lt;TableName&gt;
　　來看範例吧，先建立測試用資料表
IF OBJECT_ID('TestTable') IS NOT NULL   BEGIN   </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6635300783886926277/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/12/2-density.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6635300783886926277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6635300783886926277'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/12/2-density.html' title='[查詢優化]影響執行計畫的因素2-Density(密度)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-_1_zDtn2Spc/TtNCQk3Ih1I/AAAAAAAAARk/p66QAUostB0/s72-c/%25E6%259C%25AA%25E5%2591%25BD%25E5%2590%258D.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5914228433965192429</id><published>2011-11-04T22:28:00.016+08:00</published><updated>2012-01-04T14:30:29.407+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='查詢優化'/><title type='text'>[查詢優化]影響執行計畫的因素1-Predicates(述詞)</title><summary type='text'> 　　你有在看執行計畫嗎？為什要看它呢？因為執行計畫重要到SQL Server會建立它 、重用它甚至重建它來幫助執行你的查詢，如果你能了解SQL Server為何會產生那樣的執行計畫，相信能夠幫助你設計出較有效率的查詢喔。

　　SQL Server對於每一個送來的查詢必定經過下面四個步驟：


•解析：有效的語法會被解析成樹形表示式 
•綁定：針對表示式會做驗證，比對資料庫的表與列以確保查詢有效

•優化：查詢最佳化工具會評估各種可能的執行計畫，找出一個最優的  
執行：系統執行，回傳結果　　
　　我們需要注意的是優化這塊，理論上查詢最佳化工具會評估各種可能的執行計畫，然後找出一個最優的，但是想像一下，A與B兩個資料表相互JOIN，執行計畫有幾種，可以A JOIN B，也可以B JOIN A，這樣就有兩種；A 、B與C三個相互JOIN呢？有３！也就是六種；若有N個相互JOIN，就有N！</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5914228433965192429/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/11/1-predicates.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5914228433965192429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5914228433965192429'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/11/1-predicates.html' title='[查詢優化]影響執行計畫的因素1-Predicates(述詞)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-FJBB9VBtHM8/TrN8OIwyPmI/AAAAAAAAAP8/zhE4WlsuPLA/s72-c/Untitled.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6919666574937324010</id><published>2011-10-26T22:15:00.003+08:00</published><updated>2011-10-27T11:54:40.046+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server Denali'/><title type='text'>SQL Server Denali的範例資料庫安裝體驗</title><summary type='text'>　　看大家都在進行SQL Server Denali CTP3的測試，想說我也趕緊來試一試,，不然落後別人太多不好意思，因SQL 2008 R2還可以安裝在Win 2003上，結果一試SQL Server Denali已經不支援了，得安裝在Windows Server 2008 SP2或Windows Server 2008 R2 SP1上，只好趕緊去找Windows Server 2008來裝，裝完再裝sp2，想說應該可以裝SQL Server Denali了吧，結果還得裝.NET 3.5 SP1與Windows PowerShell 2.0
　　好不容易終於裝完了，結果發現也同SQL 2008 R2一樣沒範例資料庫，沒關係，去Adventure Works for SQL Server Denali CTP3 下載，不過這次與之前安裝SQL 2008 R2的範例資料庫時不太一樣，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6919666574937324010/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/10/sql-server-denali.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6919666574937324010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6919666574937324010'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/10/sql-server-denali.html' title='SQL Server Denali的範例資料庫安裝體驗'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-i0XKR_9Ufsg/TqjKapeqhdI/AAAAAAAAAPQ/Qd4vE25DYYc/s72-c/2008R2.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6065585932990590604</id><published>2011-10-06T20:40:00.020+08:00</published><updated>2011-10-06T20:40:00.407+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><category scheme='http://www.blogger.com/atom/ns#' term='安全性'/><title type='text'>利用IPSec建立內部防火牆以提升資料庫安全</title><summary type='text'>　　一般公司都會有外部防火牆來防止駭客直接入侵，那內部防火牆要防誰呢？當然是來防內賊的，一般無內部防火牆的情況下，只要知道資料庫的ＩＰ、帳號及密碼，在內網就能夠去取得資料庫的資料，如果使用IPSec來建立內部防火牆，就能設定IP白名單，僅允許白名單上的伺服器可連接資料庫，這樣就算內部無權的人取得資料庫的帳號密碼也沒法取得資料，除非他有辦法透過那幾台在白名單裡的伺服器去連囉，這樣不就可以提升資料庫的安全性嗎！最近個資法的施行細則也快公布了，有免錢可以提升安全性的做法，是不是該考慮一下
　　IPSec的說明、安裝及使用方式我就不介紹了，網路上一堆參考資料，自己去搜尋吧！
　　我直接給設定指令IPSECCMD的範例，IPSECCMD是給XP及Win server2003用的，Win Server2000則是用IPSECPOL囉，參數基本上差不多，都需要另外安裝

::-----------</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6065585932990590604/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/10/ipsec.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6065585932990590604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6065585932990590604'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/10/ipsec.html' title='利用IPSec建立內部防火牆以提升資料庫安全'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8337271733875832454</id><published>2011-10-03T20:25:00.005+08:00</published><updated>2011-10-06T13:40:15.251+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><title type='text'>SQL 2008 R2的SSMS工具竟不能連SQL 2005的Reporting Services</title><summary type='text'>　　今天心血來潮用SQL 2008 R2的SSMS工具去連SQL 2005的Reporting Services時，出現如下錯誤訊息，心想我跟這工具有哪麼不熟啊，竟然會出錯

其他資訊:
報表伺服器 WMI 提供者錯誤:
無效的名稱區 (Microsoft.SqlServer.Management.UI.RSClient)
------------------------------
無效的名稱區 (System.Management)
------------------------------　　試了幾遍，都一樣，怎麼我連工具也不會用了，可是明明SQL 2008的SSMS可以連SQL 2008的RS，SQL 2005的SSMS也可以連SQL 2005的RS啊，偏偏SQL 2008的SSMS就是不給我連SQL 2005的RS
　　
　　上網一查，這篇SQL Server </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8337271733875832454/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/10/sql-2008-r2ssmssql-2005reporting.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8337271733875832454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8337271733875832454'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/10/sql-2008-r2ssmssql-2005reporting.html' title='SQL 2008 R2的SSMS工具竟不能連SQL 2005的Reporting Services'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-uXhOqWYPn80/To02yKREieI/AAAAAAAAAPE/vLw6RD6h3pA/s72-c/x.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1254879251478783593</id><published>2011-09-21T22:40:00.086+08:00</published><updated>2011-09-22T09:12:47.290+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>利用EPM Framework來延伸「以原則為基礎的管理」功能到SQL Server 2005及SQL Server 2000</title><summary type='text'>　　這次參加Tech．Day 2011聽到陳俊宇老師提到EPM Framework，這EPM可以把SQL 2008的PBM「以原則為基礎的管理」功能向下套用到SQL 2000及SQL 2000呢，於是在測試環境試了一下，發現還真不錯用，雖只是在SQL Agent Job裡面利用PowerShell把評估的原則套用到舊版的SQL Server上，並把評估的結果寫到中央管理伺服器(CMS)裡，讓你之後可以查閱相關評估結果，但它並不只是如此而已，還利用SQL Server 2008 Reporting Services讓你有漂亮的報表可以看喔，像下圖的報表的例子，我測試環境的狀況是一台是SQL 2005，另一台是SQL 2000的

﻿
我簡略說明一下安裝步驟
0.環境裡，至少CMS要是SQL Server 2008以後的版本，然後SQL Agent的服務啟動帳號最好為網域帳號，權限要足夠

</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1254879251478783593/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/09/epm-frameworksql-server-2005sql-server.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1254879251478783593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1254879251478783593'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/09/epm-frameworksql-server-2005sql-server.html' title='利用EPM Framework來延伸「以原則為基礎的管理」功能到SQL Server 2005及SQL Server 2000'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-ej4WPn3FTCo/TnmdEVhJKSI/AAAAAAAAAO4/f-N6bzBMQRs/s72-c/g.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1700831749473958664</id><published>2011-09-15T20:52:00.011+08:00</published><updated>2011-09-16T14:55:38.683+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>列出目前資料庫裡，欄位定序與資料庫定序不同的所有欄位</title><summary type='text'>訊息468，層級16，狀態9，行1無法解析equal to 作業中"Chinese_Taiwan_Stroke_CI_AS" 與"Chinese_Taiwan_Stroke_90_CI_AS" 之間的定序衝突。
　　近一個月內就讓我遇到兩次上面這個錯誤，上一次是跨Server的，這一次則是發生在同一個DB內的，想說寫一個簡單的語法來找出定序不同的地方囉
--列出目前資料庫裡，欄位定序與資料庫定序不同的所有欄位
SELECT t.name [資料表名稱] ,c.name [欄位名稱],c.collation_name [定序],DATABASEPROPERTYEX(DB_NAME(),'collation') [目前資料庫定序]FROM sys.tables t INNER JOIN sys.columns cON t.object_id = c.object_id AND </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1700831749473958664/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/09/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1700831749473958664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1700831749473958664'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/09/blog-post.html' title='列出目前資料庫裡，欄位定序與資料庫定序不同的所有欄位'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4107408279286021437</id><published>2011-09-04T11:13:00.034+08:00</published><updated>2011-09-06T19:58:39.049+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>[DBA必備工具推薦]Adam Machanic設計的who is active</title><summary type='text'>　　我一直在找一個可用來監視目前SQL Server活動的好工具，因為2008 SSMS的活動監視器讓我用的很不習慣，sp_who？顯示的資訊又過多，不過現在終於讓我找到替代工具啦，就是Adam Machanic設計的who is active啦，不推薦一下不行

1.Who is Active: The License，只要不是用在商業目的，幾乎是免費使用的

2.一個who_is_active，抵過sp_who2、sp_who3、sp_who4、sp_who5、sp_who6及活動監視器喔

3.它只顯示適當的資訊，不像第二點提到的那些工具都顯示一大堆沒用的資訊

4.可自訂成你想呈現的欄位，不想看的就不要看

5.蒐集的資訊來自15 個DMV喔，第一版發布於2007/12/31號，目前已出到
Who is Active v11.00了，這可是Adam Machanic的心血結晶啊
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4107408279286021437/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/09/dbaadam-machanicwho-is-active.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4107408279286021437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4107408279286021437'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/09/dbaadam-machanicwho-is-active.html' title='[DBA必備工具推薦]Adam Machanic設計的who is active'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5996478494103365226</id><published>2011-08-28T08:13:00.002+08:00</published><updated>2011-08-30T11:20:49.855+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><title type='text'>DBA的角色正在改變，你準備好了嗎？</title><summary type='text'>　　今天看到John Sansom部落格的一篇文章Your DBA Role is Changing. Are you Ready?
，裡面提到技術不斷地改變，改變是一個不可避免的趨勢，說不定將來某一天你現在的角色已經不存在了，你有沒有想過那時候你在幹甚麼？若你一直堅持不改變，會不會就失業了？

　　10 Character Traits of Outstanding DBA’s，這篇則提到傑出DBA的十個特點，像是要觀察入微、有解決問題的能力與熱情、及高的抗壓性等等，有幾點我覺得都是講與人溝通協調的能力吧，那現在的你符合其中幾點呢？

　　裡面也提到未來需要的技能有四個，個人覺得顧客服務的能力真的很重要，像我有次去面試就是因為這個經驗不足被刷掉的，那時面試的主管還跟我說，在我們這裡技術不是最重要的，最重要的服務顧客的能力，我深深記在腦海裡啊

　　另外John Sansom還建議每個</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5996478494103365226/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/08/dba.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5996478494103365226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5996478494103365226'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/08/dba.html' title='DBA的角色正在改變，你準備好了嗎？'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6348595921763141975</id><published>2011-08-23T20:16:00.016+08:00</published><updated>2011-08-24T15:45:56.026+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><title type='text'>資料表值建構函式Values的用法</title><summary type='text'>　　很特別的Value子句用法，2008之後的版本才有支援，先記起來，怕之後要用忘了怎麼用
　　根據BOL資料表值建構函式裡提到，資料表值建構函式可以在INSERT 陳述式的VALUES 子句、MERGE 陳述式的USING &lt;來源資料表&gt; 子句以及FROM 子句的衍生資料表定義中指定。也就是說可以用在三個地方！   　　以下的例子多為BOL上的，自己稍微改一下加上補充說明囉
--1.用在Insert，可以用一個Insert插入多行，最多一個Insert插入行1000行
--建立測試用的資料表USE AdventureWorks2008R2GOIF OBJECT_ID ('MyProducts', 'U') IS NOT NULL   DROP TABLE dbo.MyProducts
CREATE TABLE dbo.MyProducts (Name varchar(50),  </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6348595921763141975/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/08/value.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6348595921763141975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6348595921763141975'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/08/value.html' title='資料表值建構函式Values的用法'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3921145641667902476</id><published>2011-08-18T22:18:00.004+08:00</published><updated>2011-08-24T15:42:30.763+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='資安'/><title type='text'>擋住資安骨牌效應研討會的新知分享</title><summary type='text'>　　上週參加資安人舉辦之"擋住資安骨牌效應研討會"，聽到幾個新的攻擊手法(對我來說是新的啦，我很孤陋寡聞的，真該檢討啊)
　　第一個是Xecure Lab的Benson博士所介紹的攻擊手法APT（Advanced Persistent Threat，進階持續性威脅），APT有人說它是網路裏的鬼，到目前為止還沒有任何軟硬體設備可以完防這種攻擊喔，而且很多國際上的重要單位都被這攻擊打得哇哇叫呢！
　　Benson博士也提到美國已經將網路攻擊視為戰爭行為囉，將APT防護層級拉之國家層級，可見這種攻擊很可怕，所以身為資訊領域的工作者，大家有必要了解一下這種攻擊手法吧
　　想多了解嗎？可參考Xecure Lab 團隊的部落格，他們團隊有提供免費的APT惡意檔案快篩服務呢！內含有APT投影片可去下載來參考喔！　　另外，資安人科技網的駭客技術與新興威脅知識庫也有APT的相關資訊可參考！

　　</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3921145641667902476/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/08/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3921145641667902476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3921145641667902476'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/08/blog-post.html' title='擋住資安骨牌效應研討會的新知分享'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6526535304454158855</id><published>2011-08-18T20:53:00.071+08:00</published><updated>2011-08-19T11:13:35.006+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>錯誤：轉換傳回狀態值 4 和狀態文字[文字已截斷，或者一或多個字元在目標字碼頁裡沒有相符者。]。</title><summary type='text'>　　錯誤: 將資料行 "Latitude" (250) 轉換成資料行 "Latitude" (156) 時，資料轉換失敗。　　轉換傳回狀態值 4 和狀態文字 "文字已截斷，或者一或多個字元在目標字碼頁裡沒有相符者。"。
　　英文的錯誤訊息
The data conversion for column "value" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page".

　　上面這錯誤，今天在設計SSIS封裝時遇到了兩次，特別紀錄一下解決方法，先說明我的資料來源都是文字檔，資料流程如下圖

　　第一種解法是忽略此錯誤，從完整的錯誤訊息可以知道是發生在哪個元件上，然後在發生錯誤的元件上按右鍵選[</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6526535304454158855/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/08/4_18.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6526535304454158855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6526535304454158855'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/08/4_18.html' title='錯誤：轉換傳回狀態值 4 和狀態文字[文字已截斷，或者一或多個字元在目標字碼頁裡沒有相符者。]。'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-F8do34XjLY4/Tk3PppHqSWI/AAAAAAAAAOo/n3JkbpJdKPM/s72-c/e1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6273275299297685</id><published>2011-08-09T20:01:00.000+08:00</published><updated>2011-08-09T20:06:05.629+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>SSIS 運算式小抄</title><summary type='text'>　　連SSIS Expression都有Cheat Sheet耶，自己去SSIS Expression Cheat Sheet瞧瞧吧，我覺得這適合初學者及久久用SSIS Expression一次的人參考吧，而且也提供pdf下載呢！可以印出來貼在桌上喔！

　　然後怎麼找到這個呢？剛好我在找如何用SSIS Expression將欄位裡的單個雙引號取代成兩個雙引號時不小心看到的，順便將解法提供給各位參考
REPLACE([COLUMN_NAME],"\"","\"\"")</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6273275299297685/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/08/ssis.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6273275299297685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6273275299297685'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/08/ssis.html' title='SSIS 運算式小抄'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8392664793193370613</id><published>2011-08-08T21:12:00.005+08:00</published><updated>2011-08-09T14:54:46.129+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>你知道作業步驟T-SQL指令碼裡可以使用Token與逸出巨集嗎?</title><summary type='text'>　　最近看到一行有著看不懂字串的T-SQL，類似像下面這行
　　EXEC usp_StoredProcdure $(ESCAPE_NONE(JOBID))

　　從$符號開始都很奇怪，ESCAPE_NONE也不像是函數，JOBID也不是字串，這兩個也不像是關鍵字，更怪的是直接拿到SSMS上執行更會告訴我什麼語法不正確，看來別人似乎用的很高興，但我卻不知怎麼用...

　　上網搜尋了一下，原來BOL作業步驟使用 Token有提到，ESCAPE_NONE是SQL Server Agent逸出巨集 ，而JOBID是SQL Server Agent token，看說明使用token可以讓你取得作業執行階段的資訊當作變數喔，不過似乎只能用在作業步驟裡 ,所以我拿到SSMS執行會錯是正常的

　　但我一時想不到我要拿這個來做什，於是上網看看有沒有相關的應用，查到陳俊宇老師的一篇淺談偵測「死結(</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8392664793193370613/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/08/t-sqltoken.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8392664793193370613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8392664793193370613'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/08/t-sqltoken.html' title='你知道作業步驟T-SQL指令碼裡可以使用Token與逸出巨集嗎?'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7333684062589343852</id><published>2011-07-25T20:28:00.000+08:00</published><updated>2011-07-26T15:54:27.359+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='SSAS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>好工具推薦- BIDS Helper</title><summary type='text'>　　好用的BIDS外掛BIDS Helper ，無意間搜尋到的，可支援SQL Server 2005到SQL Server 2008 R2，對應AS、IS及RS不同的專案會有不同的小功能喔，我覺得有些小功能很方便，像IS的就多了以下幾個我覺得很貼心的功能，推薦給各位
Deploy SSIS Packages 可以一鍵部署至遠端SQL Server上 
Expression List 條列出所有定義在封裝裡的Expression，不管設在哪的
Non-Default Properties Report 列出所有非預設值的屬性設定 
Pipeline Component Performance Breakdown 效能調教用 
SSIS Performance Visualization 效能調教用
Variables Window Extensions 可以輕易複製或搬移變數到另一個範圍
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7333684062589343852/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/07/bids-helper.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7333684062589343852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7333684062589343852'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/07/bids-helper.html' title='好工具推薦- BIDS Helper'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6568905625785401665</id><published>2011-07-17T21:28:00.003+08:00</published><updated>2011-07-19T11:39:23.004+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>[SSIS]輸出到文字檔，小數值0.123456的開頭0消失了的問題</title><summary type='text'>　　情況是這樣的，我利用SSIS從SQL Server輸出資料到文字檔，再轉給R6用，資料流程中我直接用[OLE DB來源]直接輸出到[一般檔案目的地]，結果卻遇到怪事了，就是來源資料表中有幾個欄位是numeric的格式，這幾個欄位裡面有些值剛好介於0到1之間，假設為0.123456好了，轉換過程中並沒有出錯，但直接開啟輸出後的文字檔卻發現，開頭的0都不見了，變成.123456喔，大於1的值都正常呢，很怪吧
　　網路上有看到有人有一樣的問題，Decimal Formatting from OLEDB Source to Flat File ，但沒有明確的解答，於是我做了一下測試，發現一些奇怪的事，在資料庫引擎端，NUMERIC的功能幾乎等於於DECIMAL，但在Intergration Services，DT_NUMERIC與DT_DECIMAL兩個差異倒是滿大的喔
　　</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6568905625785401665/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/07/01234560.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6568905625785401665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6568905625785401665'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/07/01234560.html' title='[SSIS]輸出到文字檔，小數值0.123456的開頭0消失了的問題'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-AphE9I9mNU4/TiPvSfv_1QI/AAAAAAAAANw/J-LH8NUtT7E/s72-c/0.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6602316389873898308</id><published>2011-07-14T21:50:00.146+08:00</published><updated>2011-07-26T17:13:50.269+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>如何用預存程序以最小權限原則呼叫遠端SSIS</title><summary type='text'>　　最近遇到一個問題，要在ASP網站上呼叫遠端SSIS，以執行轉檔的動作，遠端呼叫SSIS方法有好幾個，我這邊介紹如何用預存程序以最小權限原則呼叫遠端SSIS的方法，因為有安全性的顧慮啊，所以儘可能讓使用的權限愈小愈好囉

權限設到多小呢？我希望只給它執行該預存程序的權限就好，其他讀寫權限都沒有，看看可不可以作到吧

--1.首先請建立一個可以正常執行的作業test1，作業步驟是去執行一個已設計好的SSIS封裝mis99_test，作業的擁有者我先給sa，建立作業的語法如下，建好後，請啟動看看執行是否正常
USE [msdb]GODECLARE @jobId BINARY(16)EXEC  msdb.dbo.sp_add_job @job_name=N'test1',       @enabled=1,       @notify_level_eventlog=0,       @</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6602316389873898308/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/07/ssis.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6602316389873898308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6602316389873898308'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/07/ssis.html' title='如何用預存程序以最小權限原則呼叫遠端SSIS'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-9170831257471978573</id><published>2011-06-30T20:24:00.001+08:00</published><updated>2011-07-01T16:39:06.509+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><title type='text'>SSIS新流程轉換元件-Balanced Data Distributor</title><summary type='text'>　　最近在網路上看到有人討論BDD(Balanced Data Distributor)，心裡想說這是什麼啊，查了一下原來是SSIS新的資料流程轉換元件，2011/6/7才增加的，功能似乎是利用多核心的技術來平行處理封裝的資料流，可充分發揮Server上多處理器與多核心的效能喔
　　詳細說明請參考The “Balanced Data Distributor” for SSIS，裡面也有提供下載位址，安裝也很簡單，使用更簡單，根本不用設定，我自己測試的結果，將三百萬筆的文字檔資料轉到資料庫去，使用BDD的確有比較快喔　　什麼情況適合使用BDD呢?

1. 來源有大量的資料，因為資料少用起來沒感覺押，還有可能更糟2. 從資料來源讀取的速度比寫入目的地快的情況，尤其適用效能瓶頸是發生在目的地時，像是將文字檔寫到SQL Server就可用喔3. 資料有順序相關性的就不適用，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/9170831257471978573/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/06/ssis-balanced-data-distributor.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/9170831257471978573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/9170831257471978573'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/06/ssis-balanced-data-distributor.html' title='SSIS新流程轉換元件-Balanced Data Distributor'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-tcywqapcGyg/Tg13SH3nw_I/AAAAAAAAANU/wWqwxqOOfnw/s72-c/0.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2182605803969629488</id><published>2011-06-21T20:53:00.003+08:00</published><updated>2011-06-21T21:56:16.878+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><title type='text'>在SQL Server 2008 R2中編輯與開啟 DTS 封裝檔案的問題</title><summary type='text'>　　今天小試了一下SQL 2008 R2對舊版DTS的支援程度，但我竟然花了快兩個小時還打不開DTS，我有參考如何：安裝 Data Transformation Services 封裝的支援這篇的說明來作喔，明明我該裝的都裝了，但一直出現請安裝SQL Server 2000 DTS 設計師元件的錯誤

　　最後我一直打不開的原因竟是我錯裝了英文版的Microsoft SQL Server 2005 回溯相容性元件與Microsoft SQL Server 2000 DTS 設計師元件，問題是從SQLServer2005_BC.msi與SQLServer2005_DTS.msi檔名來看，並沒有語系的區分啊，一般有區分語系的不是檔名會加cht嗎？如果有顯示語系，我一開始下載就不會搞混了！不過沒有也該有防呆設計吧，害我白裝了好幾遍！真是的
　　
　　另外我雖然可以開啟DTS了，不過開啟某些</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2182605803969629488/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/06/sql-server-2008-r2-dts.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2182605803969629488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2182605803969629488'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/06/sql-server-2008-r2-dts.html' title='在SQL Server 2008 R2中編輯與開啟 DTS 封裝檔案的問題'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5107063367237894908</id><published>2011-06-14T21:19:00.000+08:00</published><updated>2011-06-16T13:20:51.760+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>查詢Database Mail相關設定與發送紀錄</title><summary type='text'>　　Database Mail我之前用都設定完就不管它了，沒特別研究，今天剛好誤判一封mail怎麼沒收到，才想說有沒有相關指令可查詢歷史紀錄的，才發現原來有好多指令可用喔，連發送過的郵件與發送失敗的原因都查的到說，特此紀錄一下，以免忘記

　　以下指令在SQL 2008 R2也可用喔

--列出Database Mail設定檔SELECT * FROM msdb.dbo.sysmail_profile
--列出Database Mail帳戶SELECT * FROM msdb.dbo.sysmail_account
--列出設定檔對應的帳戶select * from msdb.dbo.sysmail_profileaccount
--列出主要的設定檔select * from msdb.dbo.sysmail_principalprofile
--Mail Server相關設定</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5107063367237894908/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/06/database-mail.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5107063367237894908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5107063367237894908'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/06/database-mail.html' title='查詢Database Mail相關設定與發送紀錄'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3140481872450930938</id><published>2011-06-08T22:58:00.033+08:00</published><updated>2011-06-14T19:55:50.896+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>[BUG]衍生資料行裡的變數竟只會帶初使值？</title><summary type='text'>　　最近有人在無名問我SSIS裡變數的問題，他是用指令碼元件去取得變數，最後將變數塞回到文字檔裡，但結果竟然為0，原以為是對方有地方沒設定好，結果我試了竟然也一樣
　　剛好上胡百敬老師的SSRS的課，順便問了老師這問題，老師幫忙試了也是一樣，看來是衍生資料行這東西搞鬼，不知為什會取得變數的初始值，後來上網查了一下，這篇也有類似的問題，SSIS - user variable used in derived column transform is not available - in some cases，不只我一人遇到，看來應該是Bug啊

圖(一)﻿　　如圖(一)封裝裡有個全域變數varCnt初始值為9，裡面有一個資料流程工作與指令碼工作，指令碼工作的用途是在最後秀varCnt的值而已，而在資料流程工作中會利用指令碼元件取得某個資料表筆數為701再塞給varCnt，再將varCnt</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3140481872450930938/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/06/bug.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3140481872450930938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3140481872450930938'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/06/bug.html' title='[BUG]衍生資料行裡的變數竟只會帶初使值？'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-B0-x9LDGapA/TfWxbop425I/AAAAAAAAANM/Zl-FFTrIq8g/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7353182242227969714</id><published>2011-06-01T21:47:00.001+08:00</published><updated>2011-06-03T16:25:02.261+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>API 伺服器資料指標用的系統預存程序sp_cursoropen、sp_cursorfetch...</title><summary type='text'>　　不知你曾注意到用Profiler追蹤一些事件時，會看到明明很簡單的一行Select語法，後面卻跟了一大串的
  declare @p1 int…
  Fetch API…
  exec sp_cursorfetch…
     之類的，一直重複，如下圖(一)紅框處，前一行是簡單的Select　　圖(一)
　　以前我看到時，認為這是系統背後運作的東西，就忽略它，直到最近同事問我，他系統有段地方會執行簡單的Select語法，資料也沒很多，頂多千筆資料吧，常常執行到逾時，我看他的Select語法真的很簡單，直接在SSMS執行還滿快的
　　那我就用Profiler幫他追蹤到底在SQL端執行了什麼，一錄又錄到圖(一)的一大串東西，跑起來還真的很慢很慢，這時我就不能忽視它了，仔細一看，奇怪，為什會用到像是指標行為呢？用指標一筆一筆跑當然快不起來囉，那我就問我同事程式那段在作什，他說有用到分頁　　</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7353182242227969714/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/06/api-spcursoropenspcursorfetch.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7353182242227969714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7353182242227969714'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/06/api-spcursoropenspcursorfetch.html' title='API 伺服器資料指標用的系統預存程序sp_cursoropen、sp_cursorfetch...'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-UuD1wlRLPtM/TedTFM20FMI/AAAAAAAAANE/XD_hN5D8mt0/s72-c/2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2313137524073163492</id><published>2011-05-21T17:13:00.005+08:00</published><updated>2011-05-26T09:27:18.071+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>SSIS資料類型對應的問題</title><summary type='text'>　　我有一個封裝，會從遠端FTP下載XML檔案到本機，然後用Foreeach迴圈容器列舉下載來的檔案，將完整檔案名稱寫入filename變數，然後將filename傳入當參數對XML檔作一些檢核，檢核成功之後再傳入filename給執行SQL工作(呼叫SP用OPENROWSET)將XML檔案寫回資料庫。

　　原本排程執行都很正常的，突然之間發生錯誤，錯誤擷取訊息如下
  無法大量載入，檔案"c:\file\20110509(X＆X-DDD01).XM" 不存在。
　　封裝流程如下圖

　　我當時只注意到檔案不存在，去看了一下檔案，檔案明明在啊，然後我手動下SP執行看看，也成功載入，仔細看了一下檔案名稱裡有個全型的&amp;符號，這＆符號也並非windows下不合法的檔名啊，但我去掉了&amp;符號再執行封裝試試，還真的成功了，難道SSIS封裝對這種全形符號相衝嗎?
　　我又回去看了一下錯誤，發現傳入</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2313137524073163492/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/05/stringvarchar.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2313137524073163492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2313137524073163492'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/05/stringvarchar.html' title='SSIS資料類型對應的問題'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-vOPXZWi9xYA/TdYw9VFSJBI/AAAAAAAAAMg/-N0gsiKqA2I/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7343144669570341402</id><published>2011-05-15T20:37:00.001+08:00</published><updated>2011-05-16T11:27:39.702+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>你知道Update陳述式更新欄位值的同時可指派給變數值嗎?</title><summary type='text'>　　你可曾注意到BOL關於UPDATE (Transact-SQL) 這章節裡，有下列這樣一行嗎？

　　　SET @variable = column = expression
　　
　　平常我為了取得Update後的某欄位值，通常會在Update之後再下一次Select去取得該欄位，但其實不用那麼麻煩

　　在Update欄位值的同時可以將更新後的值，直接指派給變數喔，這用法好酷，我直到看到Assign a variable while changing the column – a little known trick才知道可以這樣用，但其實BOL早有寫了，這件事告訴我，我BOL沒仔細看啊，BOL說明截取如下
SET @variable = column = expression 會將變數設成與資料行相同的值。這有別於 SET @variable = column、column =</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7343144669570341402/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/05/update.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7343144669570341402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7343144669570341402'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/05/update.html' title='你知道Update陳述式更新欄位值的同時可指派給變數值嗎?'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-Q9SQ-HYKtXk/TdCXLJV7PcI/AAAAAAAAAMc/q9PHo3Z2fx0/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6038610546356583246</id><published>2011-05-14T07:28:00.004+08:00</published><updated>2011-05-23T10:03:39.833+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>在指令碼元件中寫回ReadWriteVariables中的變數</title><summary type='text'>　　情況是在資料流程中，我有一SQL命令(OLE DB來源)，中間利用多重傳遞，產生三個副本寫到三個不同的資料表ABC(OLE DB目的地)，三個資料表ABC幾乎只有幾個欄位上的差異，一次只會傳遞一筆資料到三個資料表
　　三個目的資料表都有個InsuranceID欄位，但是只有資料表A是設成identity，資料表BC都沒有設，然後每次傳遞三個資料表的InsuranceID都要一樣才行，要不然前端程式會對應不到，所以在SQL命令中已使用( ident_current('資料表A')+1)先取得InsuranceID了，這樣產生的三個副本就都一致啦
　　我想順便取得這次的InsuranceID欄位值，方便我將InsuranceID值Update到另一個資料表去，但是我不想再下一次SQL命令啦，想到說我可以再用一個副本，然後用指令碼元件去接那個欄位，寫入變數供之後使用，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6038610546356583246/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/05/readwritevariables.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6038610546356583246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6038610546356583246'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/05/readwritevariables.html' title='在指令碼元件中寫回ReadWriteVariables中的變數'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-JBTjSIfEOA0/TdnAVjhtEAI/AAAAAAAAAMw/8BK0CF-2lFw/s72-c/2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4457275133759975264</id><published>2011-05-06T20:03:00.004+08:00</published><updated>2011-08-22T15:06:52.150+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2008 R2'/><title type='text'>你知道SQL 2008有optimize for ad hoc workloads選項嗎?</title><summary type='text'>　　今天不小心逛到個部落格Do You Enable “Optimize for Ad Hoc Workloads”?，看到作者作了個投票，調查使用SQL Server 2008的有多少人啟用optimize for ad hoc workloads 選項，結果不知道這個選項所佔的比例竟然最高呢，我也屬於不知道這個選項的人，因為我還在用SQL 2005啊，當然不知道有這個選項
　　不知道的沒有關係，重點是這篇文章衍生的幾篇文章，都是關於最佳化執行計畫快取的文章，我覺得都還滿有參考價值的，特此紀錄一下，也給各位參考，有興趣的自己點進去看吧！</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4457275133759975264/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/05/sql-2008optimize-for-ad-hoc-workloads.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4457275133759975264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4457275133759975264'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/05/sql-2008optimize-for-ad-hoc-workloads.html' title='你知道SQL 2008有optimize for ad hoc workloads選項嗎?'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7634345847793134043</id><published>2011-04-27T20:15:00.010+08:00</published><updated>2011-04-27T22:48:26.336+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB Script'/><title type='text'>WQL(SQL for WMI)  0x80041017 錯誤碼</title><summary type='text'>　　之前自動刪除七日前的檔案這個vbs，裡面的WQL我改用了Like後，突然不能正常執行，出現下面這個錯誤
F:\deleteExpfile.vbs(17, 1) (null): 0x80041017　　　　錯誤的第17行是下面這行，記得之前用都很正常啊
For Each objFile in colFiles　　乍看之下跟我改的似乎沒有關係，看這錯誤碼也看不出所以然，想了一下之前為什可以的，比對了一下環境，發現只要用Like，在win 2003可以正常執行，win 2000就會出錯，感覺似乎跟OS版本有關
　　上網查了一下錯誤碼，在WMI Error Constants有找到0x80041017錯誤的解釋，為Query was not syntactically valid.，所以是WQL有問題囉，並不是那第17行的錯，那就是我改用了Like的關係，後來找到了MSDN上對於LIKE </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7634345847793134043/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/04/wqlsql-for-wmi-0x80041017.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7634345847793134043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7634345847793134043'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/04/wqlsql-for-wmi-0x80041017.html' title='WQL(SQL for WMI)  0x80041017 錯誤碼'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1903189610820571070</id><published>2011-04-24T11:37:00.004+08:00</published><updated>2011-04-26T13:21:49.783+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><title type='text'>[SSMS小技巧]自訂新增查詢範本</title><summary type='text'>　　原本以為要自訂[新增查詢]範本，需用SSMS搭配外掛SSMS Tools Pack，沒想到SSMS 2005就可以自己弄了，如下圖，可以改成自己想要的喔，修改很簡單，分享給大家


　　編輯SQLFile.sql即可，檔案位置在
　　C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\sqlworkbenchprojectitems\Sql\
　　
　　若為SQL 2008的，把藍字90改為100即可</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1903189610820571070/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/04/ssms.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1903189610820571070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1903189610820571070'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/04/ssms.html' title='[SSMS小技巧]自訂新增查詢範本'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-0vUPiqB2IR4/TbZBTyz46dI/AAAAAAAAAMU/sM2fNXwqcq8/s72-c/s.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3514874064460810720</id><published>2011-04-23T09:15:00.001+08:00</published><updated>2011-04-23T10:04:12.903+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><title type='text'>根據驗證程序，遠端憑證是無效的</title><summary type='text'>　　原本在別台上可以正常運作的VB.NET(SSIS的指令碼工作)寄信程式，搬移到另一台竟會出錯，錯誤為"根據驗證程序，遠端憑證是無效的"，這程式只是利用NetworkCredential作SSL驗證，System.Net.Mail去寄信而已
　　這錯誤很怪的地方有兩個，一是用try catch居然捕捉不到，這我不知為什，另一個就是這台出錯，其他台都不會

　　上網搜尋相關資訊，這篇Troubleshooting: 根據驗證程序，遠端憑證是無效的。有相關解答，解法就是避開憑證檢查的步驟囉，但此篇是C#版，後來我有找到VB版的，基本上加入藍字的部分就好，黑字是原本的程式，如下

'先加入命名空間imports System.Net.Security
imports System.Security.Cryptography.X509Certificates


'在驗證前加入此行
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3514874064460810720/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/04/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3514874064460810720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3514874064460810720'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/04/blog-post.html' title='根據驗證程序，遠端憑證是無效的'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6690843567042457929</id><published>2011-03-22T20:49:00.002+08:00</published><updated>2011-03-23T16:13:46.360+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>字母日期格式的問題</title><summary type='text'>　　最近剛好在看這篇Fight Your Fear for Date Calculations，裡面有提到這種"2010 Jan"字母日期，我想說要解這種問題，首先要讓SQL Server可以辨識這樣的日期格式，由於之前沒碰過這種格式，於是去BOL字母日期格式查看，發現SQL Server本身就可以辨識下面這些格式了 (括在方括號中的字元是選擇性的)Apr[il] [15][,] 1996 [15] Apr[il][,] 1996  
1996 APR[IL] [15]1996 [15] APR[IL]
　　那我試下面的T-SQL，看到底能不能正確轉換
　　select cast('1996 APRIL 15' as datetime)

　　結果出錯，是怎樣，BOL有錯嗎?

訊息241，層級16，狀態1，行1
從字元字串轉換到datetime 時，轉換失敗。　　我試了BOL</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6690843567042457929/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/03/blog-post_22.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6690843567042457929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6690843567042457929'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/03/blog-post_22.html' title='字母日期格式的問題'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh6.googleusercontent.com/-CtRsO8ZxbaM/TYmmL8HNmeI/AAAAAAAAAMQ/j3t0mf9nu6M/s72-c/mm.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4084375342465151817</id><published>2011-03-16T20:20:00.001+08:00</published><updated>2011-03-18T15:18:28.627+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>一般檔案目的地的格式問題</title><summary type='text'>　　SSIS中Flat File Destination的一般檔案格式畫面明明有4個選項，如下圖 
﻿使用分隔符號(Delimited)
固定寬度(Fixed Width)
有資料列分隔符號的固定寬度(Fixed width with row delimiters)
不齊右(Ragged Right)
　　但是你設完後，試圖從屬性視窗去改或是編輯器那邊改，會發現只有三個，[有資料列分隔符號的固定寬度]是沒有的，會不會很怪

　　一開始我以為是bug，後來才在一般檔案連接管理員找到說明，是可以設定[有資料列分隔符號的固定寬度]的，但是要用模擬[不齊右]喔，好怪的解法

　　然後這4個選項，我覺得若沒用過，真的很不容易懂，我把四個選項的產出的結果列出　　來源是AdventureWorks資料庫　　指令為select top 3 * from Sales.Currency　　資料如下</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4084375342465151817/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/03/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4084375342465151817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4084375342465151817'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/03/blog-post.html' title='一般檔案目的地的格式問題'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh3.googleusercontent.com/-bhjFobqSJNs/TYHTNpXfDDI/AAAAAAAAAL8/J7JuF4y6PmY/s72-c/a.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4685525754413482586</id><published>2011-03-08T22:42:00.000+08:00</published><updated>2011-03-10T09:14:26.283+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>好工具推薦-SSMS Tools Pack</title><summary type='text'>　　推薦一個好用的SSMS的外掛給大家，SQL Server資料庫管理員與開發人員必備，就是SSMS Tools Pack，大大的加強了SSMS的功能喔，支援SSMS 2005到最新的2011 CTP1呢，裝好後會多個功能表，如下圖
功能簡介 這邊介紹幾個功能，更詳盡的功能請至Features看吧New query template（產生自訂的"新增查詢"模板，這功能我很喜歡，身為DBA，難免需要去Production下Update與Delete指令，一旦下錯可是很恐怖的，有了這各就可以自定模板，少打好幾行，少按好幾個Enter，然後把每次的可怕指令包在交易裡，確認無誤再COMMIT或是有錯趕快ROLLBACK），如下圖那樣
Window Content History, Query Execution History and Current Window History(執行命令歷程，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4685525754413482586/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/03/ssms-tools-pack.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4685525754413482586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4685525754413482586'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/03/ssms-tools-pack.html' title='好工具推薦-SSMS Tools Pack'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh4.googleusercontent.com/-HM7EPeNCMWw/TXcjn7gBnRI/AAAAAAAAAL0/TnKVQxTVgP8/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5257212498637169321</id><published>2011-03-02T20:29:00.005+08:00</published><updated>2011-03-04T13:30:32.307+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSAS'/><title type='text'>部署SSAS 2005時出現帳戶名稱與安全性識別碼無法對應的錯誤</title><summary type='text'>　　小弟要將SSAS 2005的專案從遠端部署到測試機上 ，結果一按處理，馬上就出現帳戶名稱與安全性識別碼無法對應的錯誤，初次看到這個錯誤，會想是我目前這台開發機與測試機的帳號對應不起來嗎？還是權限不足呢？雖然目前是用本機管理員帳號登入，可是開發機與測試式機帳密都一樣啊，權限不會不足，我又試了有管理員權限的Domain user登入，結果一樣，那應該不是這個問題
　　想說我對AS沒有很熟，別浪費時間了，直接上網找答案最快，不過輸入中文的錯誤訊息，只找到一兩篇啊，不過第一篇就找到解答了，運氣不錯喔，解答如下連結
http://blog.csdn.net/hanks_gao/archive/2010/07/15/5738489.aspx，就是某各角色裡的成員帳號是不存在的，所以對應不到，一查果然如此，把那各帳號刪除就可以成功部署啦
　　我這篇主要不是要講這個，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5257212498637169321/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/03/ssas-2005.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5257212498637169321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5257212498637169321'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/03/ssas-2005.html' title='部署SSAS 2005時出現帳戶名稱與安全性識別碼無法對應的錯誤'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7861553997860845779</id><published>2011-02-24T20:30:00.001+08:00</published><updated>2011-02-25T11:41:29.894+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>想挑戰自己撰寫T-SQL的能力嗎?</title><summary type='text'>小弟最近逛到一網站Beyondrelation，裡面有很有趣的議題，TSQL Challenges for Beginners(TCB)與TSQL Challenges，算是給database developer 評估與訓練自己撰寫T-SQL的能力的，TCB算是中等程度，TSQL Challenges則是專家級的喔，基本上都要你用一行T-SQL解決問題，一行喔，很有挑戰性吧！

像第一題我就解不出來了
TSQL Challenge 1 - Pair-wise and ordered assignment of objects from two different lists 

除了太新的挑戰以外，每題都有附上解答，就算不會解，也可以從中學到一些很特別的寫法喔</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7861553997860845779/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/02/t-sql.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7861553997860845779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7861553997860845779'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/02/t-sql.html' title='想挑戰自己撰寫T-SQL的能力嗎?'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2361466542578683932</id><published>2011-02-20T22:37:00.003+08:00</published><updated>2011-02-24T11:36:11.351+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LogParser'/><title type='text'>LogParser如何使用TSV格式</title><summary type='text'>網路上大多是LogParser使用IIS格式的介紹，很少關於TSV格式的，自己試了之後有些心得，分享給大家囉
先說說為何要用TSV格式的好了，因為我要分析的log長下面這樣，這是resin的error log
[2010/03/10 21:32:36] _mesg._jspwarn__jsp: init
[2010/03/10 21:32:47] _qqcyquery._car_0list__jsp: init
[2010/03/10 21:32:47] javax.servlet.jsp.JspException: 行 1: 'and' 附近的語法不正確。
javax.servlet.jsp.JspException: 行 1: 'and' 附近的語法不正確。
 at com.jpc.framework.taglib.Query.doEndTag(Query.java:52)
 at </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2361466542578683932/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/02/logparsertsv.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2361466542578683932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2361466542578683932'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/02/logparsertsv.html' title='LogParser如何使用TSV格式'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5556839913894142541</id><published>2011-01-27T21:51:00.009+08:00</published><updated>2011-02-05T23:21:40.614+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL Server 武林盟主大會心得</title><summary type='text'>小弟是訂閱MSDN開發人員電子報得知SQL Server武林盟主大會的，想說試一試看看囉，沒想到初試一次就通過，還好之前有寫部路格的習慣，經過人工審視資格後，也順利取得複賽門票！

收到複賽通知時有特別問可不可以帶家屬去，沒想到連帶小baby去也是OK的，於是1/22那天就帶了老婆跟一歲多的彤彤去參加競賽，順便讓老婆知道小弟在公司可不是打雜的那麼簡單。

                                                 下一個SQL Server武林盟主得獎名單



　　去到比賽場地後，領取到複賽禮，發現微軟很大方啊！原以為只有電影票，結果複賽禮很豐富喔，由上到下，由左至右，依序是按摩球、馬客杯、威秀電影票、滑鼠護腕墊、照明螺絲工具組、磁鐵、桌面吸塵器喔，挺不錯的。

複賽最重要的就是這個囉，鐺鐺鐺，號碼牌，換言之就是選擇題囉，舉牌作答。
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5556839913894142541/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/01/sql-server.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5556839913894142541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5556839913894142541'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/01/sql-server.html' title='SQL Server 武林盟主大會心得'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hxLURPv9dV8/TUF8JWUjmPI/AAAAAAAAALk/BzI6t6sylhQ/s72-c/%25E6%259C%25AA%25E5%2591%25BD%25E5%2590%258D.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3623148278572196938</id><published>2011-01-12T20:50:00.001+08:00</published><updated>2011-01-12T20:50:00.187+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL Server Profiler擷取到的奇怪指令syscharsets</title><summary type='text'>今日利用SSMS的活動監視器觀察SQL Server的處理序怎麼異常暴增，平時看才兩三百個啊，今日一看怎麼七八百個呢，而且還持續增加中，一看殘留的指令大多都一樣，如下面這個指令
select c.name,c.description from master.dbo.syscharsets c where c.id = convert(tinyint, databasepropertyex ( db_name() , 'sqlcharset')) 

直覺這個指令不太正常，正常應用程式不會去查系統資料表的啊，查字元集和排序順序作什呢？上網一查，嚇到我了，SQL Injection好像也會用這指令，可是我查了web連線數，web log與相關系統程式，都沒異常啊，我再用SQL Server Profiler擷取看看，這指令是一直出現沒錯，但前後跟隨的指令都很正常，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3623148278572196938/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2011/01/sql-server-profilersyscharsets.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3623148278572196938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3623148278572196938'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2011/01/sql-server-profilersyscharsets.html' title='SQL Server Profiler擷取到的奇怪指令syscharsets'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hxLURPv9dV8/TSvUYa11q9I/AAAAAAAAAK8/uTgUx6ME5ok/s72-c/xxx.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7438591758531546460</id><published>2010-12-25T20:57:00.001+08:00</published><updated>2011-01-28T13:20:35.281+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Photoshop'/><title type='text'>Photoshop自動產生4*6的選取範圍(置中)</title><summary type='text'>因為已半年多沒洗照片了，這次一次要洗幾百張的照片，光裁切成4*6就很費工夫，雖然有軟體可以幫你自動置中裁切，但我喜歡自己裁呀，畢竟不是每張照片置中裁切的結果都是你想要的，於是寫了個簡單script，會自動幫你產生4*6的選取範圍喔，簡化了你用滑鼠產生選取範圍的動作，你再自己錄製action配合快捷鍵使用囉，script如下，請存成*.jsx

#target photoshop;
//沖洗比例4*6
var developW = 4
var developH = 6
//判斷是否有開啟圖檔

    if(app.documents.length &gt; 0){   
        //有開啟圖檔，設定doc為目前圖檔的參照(reference)   
        var AD = app.activeDocument;   
        //var AD = </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7438591758531546460/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/12/photoshop46.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7438591758531546460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7438591758531546460'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/12/photoshop46.html' title='Photoshop自動產生4*6的選取範圍(置中)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8834726541541644772</id><published>2010-12-23T20:48:00.007+08:00</published><updated>2011-01-28T13:21:00.372+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Tomcat實現HTTP自動導到"403.4 - 禁止"錯誤頁面</title><summary type='text'>為什要這樣作呢?因為強制將HTTP自動轉到HTTPS時，有各系統會有莫名的圖示消失，很奇怪，不在server.xml設定強制轉時，不論是用HTTP或HTTPS訪問都沒問題，甚至HTTP停用只保留HTTPS來訪問也沒問題，真的很奇怪
為了強制使用者用HTTPS來訪問，而用HTTP時會有錯誤頁面告知，模擬IIS的一個功能(必須使用安全通道SSL)，IIS做很簡單，Tomcat實現同樣功能就有點複雜了，我只試出如下做法，如各位有更佳作法請告知

1.首先去某個安裝有IIS的Server將403-4.htm拷貝出來，位置大概是在C:\WINDOWS\Help\iisHelp\common\下

2.在安裝有Tomcat的Server上，在C槽建立testweb資料夾，將403-4.htm拷貝到testweb下，並更名為index.html

3.在此資料夾下再建立WEB-INF子資料夾，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8834726541541644772/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/12/tomcathttp4034.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8834726541541644772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8834726541541644772'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/12/tomcathttp4034.html' title='Tomcat實現HTTP自動導到&quot;403.4 - 禁止&quot;錯誤頁面'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-701274297317597300</id><published>2010-12-12T14:57:00.036+08:00</published><updated>2011-01-28T13:21:19.968+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Photoshop'/><title type='text'>Photoshop利用指令碼自動為圖片加框及EXIF說明</title><summary type='text'>網路上其實可找到一些現成的指令碼，但是都不合用，只好自己稍微研究了一下，自己測試過在Canon或Fujifilm的數位相機拍的照片都可用，單眼的我沒試過，因為我只用過數位相機而已(其中取得EXIF的資訊我是利用Regular Expression來取，感覺效率較好)
﻿將以下javascript存成.jsx放到C:\Program Files\Adobe\Adobe Photoshop CS5\Presets\Scripts



#target photoshop;
//將PS提到最上層
app.bringToFront();
//判斷是否有開啟圖檔   
    if(app.documents.length &gt; 0){   
        //有開啟圖檔，設定doc為目前圖檔的參照(reference)   
        var AD = app.activeDocument</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/701274297317597300/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/12/exif.html#comment-form' title='4 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/701274297317597300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/701274297317597300'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/12/exif.html' title='Photoshop利用指令碼自動為圖片加框及EXIF說明'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/TRH9kJhNAgI/AAAAAAAAAK0/t4IMTZv11gA/s72-c/PICT5760.JPG' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6959900655891064253</id><published>2010-12-11T21:30:00.003+08:00</published><updated>2011-01-28T13:21:36.268+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Tomcat強制將HTTP 80轉至HTTPS 443</title><summary type='text'>怕忘記先紀錄一下
假設HTTP與HTTPS都設定好了，確定都可正常運作

0.先備份web.xml與servel.xml

1.編輯Tomcat安裝目錄conf下的web.xml
  在&lt;/welcome-file-list&gt;與&lt;/web-app&gt;之間，加入如下的code，然後存檔

&lt;security-constraint&gt;
 &lt;web-resource-collection&gt;
 &lt;web-resource-name&gt;Protected Context&lt;/web-resource-name&gt;
 &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
 &lt;/web-resource-collection&gt;
 &lt;user-data-constraint&gt;
 &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
 &lt;/</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6959900655891064253/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/12/tomcathttp-80https-443.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6959900655891064253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6959900655891064253'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/12/tomcathttp-80https-443.html' title='Tomcat強制將HTTP 80轉至HTTPS 443'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4784899088024519695</id><published>2010-11-02T21:13:00.001+08:00</published><updated>2011-01-28T13:21:54.513+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EXCEL'/><title type='text'>Excel如何快速填滿空格，使其值為前一格的值</title><summary type='text'>這是之前上EXCEL進階課程學到的一招，我覺得很酷，紀錄一下，分享給大家
如下圖，如何快速填滿空格，使其值為前一格的值，比如說A3等A2，A4等於A3，依此類推，幾秒鐘內完成喔


1.選取其中一個儲存格(不得為空白格，比如說C2)
2.按下鍵盤上的[F5]
3.點選[特殊]
4.點選[空格]，按下[確定]
5.注意選取到的那格空白儲存格，此例是A3

按下鍵盤的[等號鍵]，選到上一格A2(注意，請看上下兩圖)

﻿6.Ctrl+Enter7.完成</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4784899088024519695/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/11/excel.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4784899088024519695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4784899088024519695'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/11/excel.html' title='Excel如何快速填滿空格，使其值為前一格的值'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/TNIaWzD1FXI/AAAAAAAAAKk/lDNrC58Nn7w/s72-c/1.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3215234295510509347</id><published>2010-10-31T21:30:00.000+08:00</published><updated>2010-11-04T09:49:22.304+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>550 5.7.1 Unable to relay(第二種情況)</title><summary type='text'>最近收到一封NDR(投遞不成功的報告)，信件內容裡[系統管理員的診斷資訊]如下

#&lt; #5.7.1 smtp;550 5.7.1 Unable to relay&gt; #SMTP#這錯誤好熟悉啊，之前我有遇過，我的這篇550 5.7.1 unable to relay有說明，不過這次寄信的程式是利用本機SMTP服務來寄信的，而且已正常運行很久了，突然出現這錯誤我感到很訝異，難道設定不小心被人動到了嗎？仔細研究後發現，這錯誤跟之前遇到的狀況不一樣，特此紀錄

首先，確認SMTP裡[轉接限制]裡的[不管以上所列的項目，允許所有通過驗證的電腦轉接]是不是沒打勾，有打勾，ok，那就不是設定的問題了

第二步，我使用smtpdiag診斷工具驗證DNS與MX有沒有問題
SMTPDIAG "sender address" "recipient address" /v
結果找不到收件位址的MX紀錄

</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3215234295510509347/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/10/550-571-unable-to-relay.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3215234295510509347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3215234295510509347'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/10/550-571-unable-to-relay.html' title='550 5.7.1 Unable to relay(第二種情況)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8395757436444711078</id><published>2010-09-19T13:48:00.003+08:00</published><updated>2010-09-24T22:33:10.451+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><title type='text'>IE重整(F5)的問題(用JavaScript重整)?</title><summary type='text'>我想這應該是個蠢問題，但也讓我試了老半天呢！
因為要上台報告，要示範一個網頁例子給同事看，想想在沒網路的情況下，只能示範HTML囉，HTML的好處就是只要有IE就可以打開的嘛，於是寫了一個簡單的HTML，上面就一個表單，有幾個欄位與按鈕，預先在欄位裡輸入好字串，到時示範就不用打，想說到時若需輸入其他文字，就算輸入錯誤，按重整(F5)後那些欄位文字應該就會還原吧，結果實際上並非我想的那樣，按F5或Ctrl+F5結果都一樣，並沒有重新載入喔，比如說，簡化的HTML內容如下，各位可以存成.html的試試
&lt;HTML＞&lt;BODY&gt;
&lt;input type=text name=St size=25 value="XXX"&gt;
&lt;/BODY&gt;&lt;/HTML&gt;用IE打開的網頁應該長的像下面這樣吧




各位可以試試修改裡面的字串後，再按F5或Ctrl+F5看有沒有重整，看起來有重整，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8395757436444711078/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/09/ief5javascript.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8395757436444711078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8395757436444711078'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/09/ief5javascript.html' title='IE重整(F5)的問題(用JavaScript重整)?'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hxLURPv9dV8/TInQoGA-qcI/AAAAAAAAAKc/quwdiWJtOQo/s72-c/x.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3767483462554834537</id><published>2010-08-27T21:34:00.001+08:00</published><updated>2010-08-31T08:48:39.225+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Websphere'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>signer information does not match signer information of other classes in the same package</title><summary type='text'>原環境為Websphere 6.0.0.1 + SQL 2000，後來資料庫升級到SQL 2005，得調整WAS的相關設定，調整的當中陸續遭遇一些錯誤，相關調整步驟就不在這邊說明囉 
一開始我更換JDBC Driver 1.2後，log出現如下錯誤
class "com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement"'s signer information does not match signer information of other classes in the same package
當時不知怎麼解，上網查到似乎是版本衝突，也沒說怎麼解，加上我跟JAVA不熟，廠商又推說重灌WAS就可了，正式站最好隨隨便便重灌啦！所以我就暫時先放棄了
過了一段時間後，想說試試看原本的Driver能不能連SQL 2005，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3767483462554834537/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/08/signer-information-does-not-match.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3767483462554834537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3767483462554834537'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/08/signer-information-does-not-match.html' title='signer information does not match signer information of other classes in the same package'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6643268761643815130</id><published>2010-08-23T21:10:00.000+08:00</published><updated>2010-08-24T09:34:21.929+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>ALTER SCHEMA出現物件已存在的錯誤</title><summary type='text'>ALTER SCHEMA new_schema_name TRANSFER old_schema_name.ObjectName

訊息 15530，層級 16，狀態 1，行 1

名稱為 "ObjectName" 的 物件 已經存在。我的情況是ObjectName是個預存程序，執行ALTER SCHEMA 後卻告訴我物件已存在，我用SSMS查遍資料表、檢視、預存程序與函數後都找不到同名的物件啊，我想說是見鬼了還是怎樣

上網查到微軟的KB937757有提到這個錯誤，但是情況不太一樣，不過點出我一個方向，就是資料庫裡一定有個物件名稱一模一樣，只不過不是資料表、檢視、預存程序與函數囉

那我想到用sys.objects目錄檢視好像可以查到所有物件的名稱，語法如下
select * from sys.objects where [name] = 'ObjectName'還真讓我查到了，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6643268761643815130/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/08/alter-schema.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6643268761643815130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6643268761643815130'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/08/alter-schema.html' title='ALTER SCHEMA出現物件已存在的錯誤'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2313430572404958965</id><published>2010-08-20T22:44:00.000+08:00</published><updated>2010-08-20T23:13:00.736+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>整數除以整數結果竟然只保留整數，那小數呢？</title><summary type='text'>最近剛好遇到前端程式與後端資料庫計算後差一塊的問題，應是資料庫端四捨五入的地方怪怪，仔細一看T-SQL語法，整數除整數，比如說51/100，不是0.51嗎？那我用ROUND(51/100,0)，應該會進位後得到1吧，結果居然是0，讓我傻眼了一下，那我直接在SSMS中，實際先下了select 51/100看看，結果真的是0，有圖有真相
我想說難道我誤設了什麼，讓資料庫自動幫我捨去小數點嗎?我查了一下，好像沒有這個設定啊，怪怪

後來經查看了SQL Server 2005 線上叢書(BOL)後，終於真相大白，在BOL中的資料類型優先順序中有提到，擷取內容如下：

當一個運算子結合兩個不同資料類型的運算式時，資料類型優先順序的規則，會指定將低優先順序的資料類型，轉換為高優先順序的資料類型。如果轉換不是支援的隱含轉換，就會傳回錯誤。如果這兩個運算元運算式的資料類型相同，則作業結果就含有該資料類型</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2313430572404958965/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/08/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2313430572404958965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2313430572404958965'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/08/blog-post.html' title='整數除以整數結果竟然只保留整數，那小數呢？'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hxLURPv9dV8/TG3vf6BHflI/AAAAAAAAAJ8/BhUum8vObFY/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4066764717805956815</id><published>2010-07-07T09:51:00.001+08:00</published><updated>2010-08-21T13:19:17.465+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><title type='text'>如何散佈DTS元件(DTSRUN)</title><summary type='text'>剛好同事需要在沒有安裝SQL Server上的伺服器上執行遠端DTS，要用DTSRUN，我把DTSRUN拷貝過去後發現無法使用，看來缺少一些檔案，上網查了一下，參考到Redistributing DTS with your program這篇，發覺檔案還不少，還得註冊dll，挺麻煩的，於是寫了簡單的SCRIPT與說明，有需要者自行更改部份內容，基本上如果用預設安裝SQL Server的，相關路徑應該就不用改

Step 1 將以下script存成batch檔後，在安裝有SQL 2000的來源端執行會產生C:\DTSuti\目錄



set InstallDestination="C:\DTSuti\"



xcopy /I "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqlresld.dll" %</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4066764717805956815/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/07/dtsdtsrun.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4066764717805956815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4066764717805956815'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/07/dtsdtsrun.html' title='如何散佈DTS元件(DTSRUN)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4857480834879037218</id><published>2010-07-03T20:02:00.012+08:00</published><updated>2010-08-21T13:20:48.234+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>在SSMS刪除舊版DTS版本的方法</title><summary type='text'>過去在SQL 2000用EM可以在DTS上按右鍵選版本，可以很容易的把舊版本的封裝刪除，保留太多版本可是會佔空間的，可是到了SQL 2005，SSMS好像沒有選項可以這麼作，刪除是直接把整各封裝給刪掉呢，而且若版本超過一個，開啟時還要選版本有點麻煩，過去在EM可是直接開最新的說，所以會想說如何把舊的版本刪掉呢?想到最簡單的方法就去MSDB內把舊版本刪掉就好啦，寫了一個簡單的Script，會印出該封裝名稱與對應刪除的指令，執行那個指令後會保留最新的版本喔


with dts as
(select distinct [name],id,(select TOP 1 createdate from dbo.sysdtspackages where id = a.id order by createdate desc) as createdate from dbo.sysdtspackages </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4857480834879037218/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/07/ssmsdts.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4857480834879037218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4857480834879037218'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/07/ssmsdts.html' title='在SSMS刪除舊版DTS版本的方法'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/TDGHUt_m8bI/AAAAAAAAAJ0/11y3ZrnKGlU/s72-c/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6623785852090472143</id><published>2010-06-02T22:24:00.002+08:00</published><updated>2010-08-21T13:29:35.725+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>在 SQL2005中編輯舊版DTS時發生錯誤</title><summary type='text'>　　今天想測試看看舊版DTS在SQL2005上運作的狀況，於是就用Enterprise Manager打開DTS，然後將DTS另存到SQL2005上
　　就在用SSMS打開舊版DTS封裝時，發生如下錯誤，見下圖

　　怪的是SQL Server 2000 DTS 設計師元件我已經裝過啦，怎麼會有問題，於是我又重裝一遍，還是一樣耶...@@
　　還好這個錯誤有說可以參考資識庫文件當您嘗試在 SQL Server 2005 中修改 SQL Server 2000 DTS 封裝時，收到錯誤訊息：「DTS 主機無法正確載入或儲存封裝」
　　看來是個Bug，我照文件的方法一，編輯Sqlwb.exe.manifest的內容就解決了喔</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6623785852090472143/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/06/sql2005dts.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6623785852090472143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6623785852090472143'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/06/sql2005dts.html' title='在 SQL2005中編輯舊版DTS時發生錯誤'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/TAhyGA81PdI/AAAAAAAAAJs/LOG4Mm_bBdk/s72-c/dts.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2924075886129771938</id><published>2010-05-30T20:35:00.001+08:00</published><updated>2010-08-21T13:23:58.096+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TortoiseSVN'/><title type='text'>TortoiseSVN的圖示覆蓋消失了</title><summary type='text'>有時電腦重開機後，TortoiseSVN的圖示覆蓋消失了，如下圖
左邊是正常的，右邊是不正常的樣子


我是不知道為何會消失啦，有時候再重開機就會正常，有時候又不會
那個圖示消失很困擾，因為就不容易知道哪個檔案庫有異動啦
後來發現改個設定似乎就正常了
在檔案總管按右鍵TortoiseSVN\設定\視覺樣式\圖示覆蓋\狀態列
[預設]改[Shell]，按套用確定後，那個圖示覆蓋就出來囉
記得再改回去</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2924075886129771938/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/05/tortoisesvn.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2924075886129771938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2924075886129771938'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/05/tortoisesvn.html' title='TortoiseSVN的圖示覆蓋消失了'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hxLURPv9dV8/TAYHAqWKjhI/AAAAAAAAAJc/voCSJLkdHco/s72-c/svn.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3456957895205324174</id><published>2010-05-23T15:47:00.002+08:00</published><updated>2010-08-21T13:28:12.631+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Websphere'/><title type='text'>java.lang.IllegalArgumentException: resolve against non-hierarchical or relative base</title><summary type='text'>因為資料庫要從SQL2000升級到SQL2005，測試DB部分已弄好，想說直接去WAS測試機改連線位置，看看原有的driver可不可以直接支援，不能就算啦，再去找解決方案，結果一改去測連線，出現奇怪的錯誤，重開機後，log有奇怪的錯誤，如下
java.lang.IllegalArgumentException: resolve against non-hierarchical or relative base 
我改回來還是一樣有錯，很可怕吧...
通常設定改回來就沒事啦，我是見鬼了嗎
上網一查，有人也有同樣的錯誤
解決辦法
1.打開\profiles\default\config\cells\具体CELL\nodes\具体NODE\resources.xml 
2.尋找&lt;　cmpDatasource href="tempworkarea.xmi#DataSource_</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3456957895205324174/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/05/javalangillegalargumentexception.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3456957895205324174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3456957895205324174'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/05/javalangillegalargumentexception.html' title='java.lang.IllegalArgumentException: resolve against non-hierarchical or relative base'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4227841811980718630</id><published>2010-04-25T09:07:00.019+08:00</published><updated>2010-08-21T13:29:01.716+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>530 5.7.1 Client was not authenticated</title><summary type='text'>　　最近收到來自一台測試機寄來的NDR副本，錯誤訊息為530 5.7.1 Client was not authenticated，因為那台測試機上面裝有SMTP服務，所以很直覺的認為是SMTP服務問題，然後測試了一下，發現同樣的程式，一下可以寄信，一下不能寄信，很詭異吧，明明沒收到信，有時收的到NDR，有時候又收不到，超怪的，怪到我都懷疑自己對SMTP是不是完全不懂了，經過幾天的測試研究，終於找到問題了，特此紀錄
　　首先我看了一下SMTP的設定，沒什特別的啊，我沒動，比對一下另一台專門發信機器的設定，沒什不一樣的，不過那台在DMZ，網路環境不一樣可能不准，這時想到有時出問題，移除重裝一下就會好，於是我又重裝SMTP，結果還是一樣，時好時壞，於是我又再另外一台電腦上裝SMTP與POP3，透過測試機的SMTP發到新裝的這台，再去新裝的這台收信，皆正常，不會有一下收的到，一下收不到的問題
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4227841811980718630/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/04/530-571-client-was-not-authenticated.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4227841811980718630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4227841811980718630'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/04/530-571-client-was-not-authenticated.html' title='530 5.7.1 Client was not authenticated'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hxLURPv9dV8/S9jb0W6JJrI/AAAAAAAAAI8/nBdvHXskdZc/s72-c/ss.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3487154870638499842</id><published>2010-03-28T15:29:00.001+08:00</published><updated>2010-08-21T13:32:29.167+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>SSIS的ErrorCode</title><summary type='text'>SSIS的資料流程工作，若轉換流程中發生錯誤，將會導致轉換失敗，若不想讓轉換失敗，是可以設定錯誤輸出將錯誤的資料列導向另一各目的地，像我是直接導到文字檔，該文字檔除了資料列本身的欄位外，還會有ErrorCode 和 ErrorColumn這兩各欄位資訊，不過這兩個欄位只包含數字碼，一開始根本看不懂是什，之後我發現ErrorColumn是指發生錯誤資料行的識別碼，原來是可以在資料來源的進階編輯器＼輸入與輸出屬性＼輸出資料行＼通用屬性裡的ＩＤ即是該錯誤資料行的識別碼，如下圖

知道這個，至少知道是哪個欄位有問題了，但還是不知道問題原因，後來又發現線上叢書，加入錯誤流程重新導向裡有提到可使用指令碼元件來存取 Integration Services API 及取得該錯誤的描述，我像發現新大陸一樣的開心，趕緊試一試，結果一執行就出錯，
災難性的失敗 (發生例外狀況於 HRESULT: </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3487154870638499842/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/03/ssiserrorcode.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3487154870638499842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3487154870638499842'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/03/ssiserrorcode.html' title='SSIS的ErrorCode'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hxLURPv9dV8/S7RGG1v1XxI/AAAAAAAAAI0/SCaImIDLCBw/s72-c/5974.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8901221562132523572</id><published>2010-02-21T14:15:00.001+08:00</published><updated>2010-08-21T13:36:11.936+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>無法開啟 bcp 的主資料檔</title><summary type='text'>之前為了讓user能夠用簡單的程式將文字檔載入SQL Server，想到用bcp配合batch檔，然後用Bat_To_Exe_Converter封裝成exe給User執行，一年過後，user反應程式忽然不能正常執行了，出現如下錯誤
SQLState = S1000, NativeError = 0

Error = [Microsoft][ODBC SQL Server Driver]無法開啟 BCP 的主資料檔


該行bcp的命令如下
bcp "database.dbo.DataTable" in c:\Input_Data.csv -f c:\Input_Data.fmt -S ServerName -U UserName -P Password -e error.txt

記得當初用bcp時就覺得bcp的錯誤訊息很難懂，像這次是無法開啟BCP的主資料檔，在user</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8901221562132523572/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/02/bcp.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8901221562132523572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8901221562132523572'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/02/bcp.html' title='無法開啟 bcp 的主資料檔'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3423397074924213516</id><published>2010-02-07T10:59:00.006+08:00</published><updated>2010-08-21T13:37:15.840+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>封裝的Protection Level</title><summary type='text'>以前在Business Intelligence Development Studio 設計SSIS封裝時，不太了解Protection Level的差異，都用預設的，結果明明在BIDS執行成功的，佈署到SQL Server上後執行就失敗，想說SSIS怎麼那麼難用啊，封裝設計的還真複雜，之前的DTS簡單多了，但又不能不用，只好研究了一下各Protection Level的差別囉

我就一一設定不同Protection Level，除了ServerStorage以外，因為這是部署到msdb上才會用的，存檔後看看封裝檔案dtsx的大小，與dtsx內容跟連線密碼有關的部分，還有用Dtexecui執行的狀況，整理如下圖

什麼時候用哪個Protection Level呢?我覺得可以分成三種情況來說

第一種是自己用，如果是自己用，通常測試的只會給自己用吧，不會給別人用，也不會佈署到Server上</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3423397074924213516/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/02/protection-level.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3423397074924213516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3423397074924213516'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/02/protection-level.html' title='封裝的Protection Level'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/S2uJ_E6W2WI/AAAAAAAAAIs/my30Sigr0ag/s72-c/level.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-967625544819611223</id><published>2010-01-23T10:16:00.027+08:00</published><updated>2010-08-23T09:59:55.509+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EXCEL'/><title type='text'>EXCEL讀取特定編碼的CSV會變亂碼</title><summary type='text'>最近剛好用EXCEL打開一個CSV檔時，發現中文字竟變成亂碼，可是用記事本打開是正常的，覺得很怪，於是上網搜尋了一下相關資訊，好像是檔案編碼不同造成的，EXCEL似乎只支援ANSI(BIG5)格式的CSV檔，Unicode的會有問題，於是自己測試了一下各個編碼的差異

整理如下圖

首先我用記事本將文,巛,test存成3個不同編碼的CSV，3個分別是ANSI、UTF8及UNICODE，怎麼用記事本存成不同編碼的呢？就另存新檔時選不同的編碼儲存就好

因為中間的"巛"算是Unicode字元，所以另存成ANSI時，就會跟你說有字元會遺失，所以就變成問號了，這是正常的

用EXCEL開啟3個不同編碼的CSV時，可以發現EXCEL是真的支援ANSI編碼的，可以正常顯示，與記事本無異，又能自動幫你分割好3欄位；Unicode則無法幫你自動分割欄位；UTF8則中文直接變成亂碼囉，欄位分割也不準，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/967625544819611223/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/01/excelcsv.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/967625544819611223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/967625544819611223'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/01/excelcsv.html' title='EXCEL讀取特定編碼的CSV會變亂碼'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hxLURPv9dV8/S2Ju9VSZJpI/AAAAAAAAAIc/YVTWqva9lVQ/s72-c/excel.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-71725818084305634</id><published>2010-01-16T10:14:00.003+08:00</published><updated>2010-08-23T10:01:44.072+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>OLE DB目的地的插入認可大小上限2147483647</title><summary type='text'>若在SQL 2005的SSIS封裝中使用[OLE DB 目的地]，在偵錯時有時封裝會一直執行不完，明明資料已經載完了，可是又沒當，可以手動停止偵錯，很怪

找找[OLE DB 目的地]的設定，發現有個[插入認可大小上限](Maximum insert commit size)，預設值為0，這個值是用在當單一資料列發生錯誤時，有多少筆會被Redirect(or Rollback)的意思，我嘗試設為別的值好像就比較不會發生封裝停止回應的事

那到底要設多少才不會停止回應呢？上網搜尋了一下，在SQL Server 2008 的線上叢書(http://msdn.microsoft.com/en-us/library/ms188439.aspx)裡有提到，若值為0可能會造成封裝停止回應，若要避免封裝停止回應，請把值設定為 2147483647，這也適用SQL 2005喔，我設了好像就好多了！</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/71725818084305634/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/01/ole-db2147483647.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/71725818084305634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/71725818084305634'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/01/ole-db2147483647.html' title='OLE DB目的地的插入認可大小上限2147483647'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7988535233722023371</id><published>2010-01-10T11:45:00.003+08:00</published><updated>2010-08-23T10:02:33.655+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>Error code: 0x80040E00</title><summary type='text'>不知為什，在SSIS中，當我[OLE DB 來源]使用IBMDA400或IBMDASQL的Provider時，在設計階段不會出錯，但執行時卻會出現如下錯誤訊息(我之前用不會耶...@@)
[OLE DB 來源 [1]] 錯誤: SSIS 錯誤碼 DTS_E_OLEDBERROR。發生 OLE DB 錯誤。錯誤碼: 0x80040E00。 
錯誤: SSIS 錯誤碼 DTS_E_PRIMEOUTPUTFAILED。在 元件 "OLE DB 來源" (1) 上的 PrimeOutput 方法傳回錯誤碼 0xC0202009。當管線引擎呼叫 PrimeOutput() 時，元件傳回失敗碼。在此之前可能已公佈過錯誤訊息，說明有關此失敗的詳細資訊。 
上網搜尋0x80040E00這Error code會發現這是已知Driver上的bug說，可參考IBM網站的</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7988535233722023371/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/01/error-code-0x80040e00.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7988535233722023371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7988535233722023371'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/01/error-code-0x80040e00.html' title='Error code: 0x80040E00'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hxLURPv9dV8/S0_SXrUKWlI/AAAAAAAAAH0/P7UjV_4NVak/s72-c/datareader.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4874397921849158325</id><published>2010-01-09T14:30:00.008+08:00</published><updated>2010-10-25T15:23:59.822+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>Telnet、SMTP Log與Mail Header</title><summary type='text'>最近遇到很多郵件傳輸的問題，但是因自己本身無法接觸到Exchange，所以想說去了解一下SMTP Services好了，反正寄信的基本功能應該不會差太遠吧。
有時候看一些Services，有LOG看才知道到底有沒有在運作，也比較清楚它作了什麼，但是一開始看SMTP的LOG，我可是愈看愈模糊啊，原來是我沒把全部的LOG資訊都啟用，所以建議啟用全部的LOG紀錄吧，尤其是擴充內容喔。

首先，參考微軟的使用 SMTP 來傳送外送訊息，裡面有提到SMTP 如何運作？我就不多做說明了，自己去看吧。

那怎麼測試SMTP Services呢，就用Telnet來檢視與SMTP交談的訊息吧，可參考微軟的這篇Telnet 至 IMC 連接埠 25 以測試 IMC 通訊。

假設安裝有SMTP Services伺服器為srv004t，發信的電腦為tst33，IP為192.168.1.1，寄件者為</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4874397921849158325/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/01/telnetsmtp-logmail-header.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4874397921849158325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4874397921849158325'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/01/telnetsmtp-logmail-header.html' title='Telnet、SMTP Log與Mail Header'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hxLURPv9dV8/S0qN5VjjAiI/AAAAAAAAAHs/c8Jq4QtBQD8/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-974966734756406544</id><published>2010-01-02T20:54:00.000+08:00</published><updated>2010-01-04T14:28:30.979+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WORD'/><title type='text'>在WORD中倒退鍵(BACKSPACE)失效</title><summary type='text'>其實這也發生好一陣子了，就是我在WORD XP中，倒退鍵（BACKSPACE）的功能一直有問題，就是明明選取了字串，按下倒退鍵要將它刪除，就是刪不掉，害我只能按Delete鍵刪，想說還可以用就算了，過了新的一年之後，想說不能繼續這樣下去，就上網查了一下，原來有解決辦法啊，KB901124，在WORD的工具列裡有個選項，裡面的編輯頁籤，把以鍵入字串取代選取部份打勾即可，原來這麼簡單，這預設好像是打勾的，我之前是手賤不小心把它按掉嗎！</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/974966734756406544/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2010/01/wordbackspace.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/974966734756406544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/974966734756406544'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2010/01/wordbackspace.html' title='在WORD中倒退鍵(BACKSPACE)失效'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3929801520072894783</id><published>2009-12-26T11:40:00.005+08:00</published><updated>2010-08-23T10:04:51.045+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>了解Email Headers所代表的意義</title><summary type='text'>我是從Reading Email Headers 這邊看到的，解說的很詳盡，我稍微把我理解的寫出來，看不懂我寫的人，只能說抱歉囉，我表達能力不好，建議各位還是去看原文吧

一般的郵件傳輸的過程至少經過4台電腦，怎麼說呢，當使用者發送郵件，會在使用者自己的電腦上產出訊息，然後訊息會先送到你指定寄件用的Mail Server（可能是你ISP用的或公司的），此時使用者的電腦已完成它的發送工作，但是Mail Server還沒完成他的工作，他會幫你找到收件者的Mail Server，跟她溝通然後將訊息傳送給她才算完成，這訊息會待在第二台Mail Server上，直到收件者讀取該訊息，將訊息下載到收件者的電腦後刪除，整個流程大概是這樣。

現在假設一個情境，有一個使用者A為adalf0722@yahoo.com.tw，使用者B為shaq.adalf@gmail.com，A想寄信給B，A利用遠端有台</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3929801520072894783/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/12/email-headers.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3929801520072894783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3929801520072894783'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/12/email-headers.html' title='了解Email Headers所代表的意義'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6681309596930838176</id><published>2009-12-22T21:06:00.009+08:00</published><updated>2010-08-23T10:07:59.544+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB Script'/><title type='text'>使用CDO.Messages來發信，未設定認證(smtpauthenticate)的奇怪現象</title><summary type='text'>基本上使用CDO.Messages來發信，可以選擇使用本機SMTP service或是遠端的SMTP，但我想大多數應該是用遠端的方式吧，畢竟不是每台Sever都有裝SMTP service的

我平常在正式環境使用都是用遠端，然後有啟用基本認證，要輸入帳號密碼後才能寄，這樣幾乎不管到哪裡，程式都能寄信，到目前為止我還沒遇過有問題的，相關程式碼在 http://adalf0722.blogspot.com/2008/12/vbs.html

但有同事也是用遠端，但是是用不需認證的方式寄信，我通常測SMTP service能不能寄信也是用這各測，程式碼如下

Set objEmail = CreateObject("CDO.Message")

objEmail.From = "adalf@test"
objEmail.To = "adalf@test"
objEmail.Subject =</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6681309596930838176/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/12/cdomessagessmtpauthenticate.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6681309596930838176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6681309596930838176'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/12/cdomessagessmtpauthenticate.html' title='使用CDO.Messages來發信，未設定認證(smtpauthenticate)的奇怪現象'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4308430929748775448</id><published>2009-12-20T20:49:00.002+08:00</published><updated>2010-08-23T10:09:06.892+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>非sysadmin在SSMS中開啟Data Transformation Services的錯誤</title><summary type='text'>資料庫為SQL 2000，只要在SQL Server 中有有效的登入權限的使用者，用Enterprise Manager（EM）開啟本機封裝不會有問題，不需要額外設定權限，但同樣的使用者若是用SQL 2005以後的管理工具SSMS中開啟舊版的Data Transformation Services就會跳出如下錯誤

SELECT 使用權限在物件 'sysdtspackages'，資料庫 'msdb'，擁有者 'dbo' 上被拒絕。 (Microsoft SQL Server, 錯誤: 229)


一查還真的沒有設定權限呢，可是為什在EM可以，在SSMS不行呢，這應該是BUG吧，上網查解決辦法就是在sysdtspackages加權限囉，看是間接加給角色或是直接加給使用者，要不然就只用EM編輯DTS囉，不過個人覺得額外加權限總是有安全性顧慮的，因為原本不用啊

</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4308430929748775448/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/12/sysadminssmsdata-transformation.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4308430929748775448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4308430929748775448'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/12/sysadminssmsdata-transformation.html' title='非sysadmin在SSMS中開啟Data Transformation Services的錯誤'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-3862257598554223939</id><published>2009-11-10T20:57:00.002+08:00</published><updated>2010-08-23T10:13:07.117+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>如何用sp_executesql將Select的值輸出</title><summary type='text'>剛好要動態組出Select陳述式，欄位是會變的那種，若不需把Select出的值輸出到一個變數，其實可直接用exec(@cmd)就好，但是若需要輸出就得用sp_executesql了，可是一直試都失敗，輸出的值都是Null，然後SQL Server線上說明又沒提什特殊設定，好在網路很方便，原來只要在sp_executesql的第二個與第三個參數那加上out就行了，下面是一個簡例，分享給剛好不知道的人

use Northwind

Declare @Count int

exec sp_executesql N'select @Count = count(*) from Orders',
N'@Count int OUT',
@Count OUT

SELECT @Count</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/3862257598554223939/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/11/spexecutesqlselect.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3862257598554223939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/3862257598554223939'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/11/spexecutesqlselect.html' title='如何用sp_executesql將Select的值輸出'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8589947228690424920</id><published>2009-10-09T20:15:00.001+08:00</published><updated>2010-08-23T10:12:08.843+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><title type='text'>DTS的owner與owner_sid不一致的問題</title><summary type='text'>最近同事反應SQL 2000的某個DTS無法儲存，會出現"Only the owner of DTS Package or a member of the sysadmin role may create new versions of it."的錯誤，意思就是只有此DTS的擁有者或是系統管理員的身分才能建立新的版本，目前那個DTS的owner不是他，那我改掉應該就行

上網查了一下發現可以用sp_reassign_dtspackageowner [@name =] 'name',[@id =] 'id',[@newloginname =] 'newloginname'來改變DTS的owner

我先請他自己建一個DTS看看顯示的owner是誰，owner是個網域帳號，我就以為我也應該把那個DTS的owner改成那個網域帳號，因為一直以來我發現雖然是用SQL帳號登入的，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8589947228690424920/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/10/dtsownerownersid.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8589947228690424920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8589947228690424920'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/10/dtsownerownersid.html' title='DTS的owner與owner_sid不一致的問題'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8188099161870411827</id><published>2009-08-15T20:50:00.004+08:00</published><updated>2010-08-23T10:14:37.677+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><category scheme='http://www.blogger.com/atom/ns#' term='VB Script'/><title type='text'>取得DTS的屬性值與全域變數</title><summary type='text'>因為之前設計了一個DTS定期撈取執行失敗的工作排程，然後會寄送mail通知相關負責人，頂多附上歷程紀錄的相關資訊，有時資訊一多，根本看不出來錯在哪裡，雖然封裝屬性裡可以設定錯誤紀錄檔，但是我不知怎麼取得相關資訊，我在資料庫裡找了好久都找不到，經過一段時間尋找，終於讓我發現啦，原來用VB Script可以取得該封裝的相關資訊啊，分享給各位囉


Dim Package

Set Package = CreateObject("DTS.Package2")

'載入該封裝，請自行替換servername,username,password,pasckage name喔
Package.LoadFromSQLServer "servername", "username","password", , , , , "package name"

'秀出屬性LogFileName的值
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8188099161870411827/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/08/dts.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8188099161870411827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8188099161870411827'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/08/dts.html' title='取得DTS的屬性值與全域變數'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6554138060585218004</id><published>2009-08-05T20:26:00.006+08:00</published><updated>2009-08-08T20:18:47.227+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP'/><title type='text'>msxml3.dll 錯誤 '800c000e'</title><summary type='text'>最近同事反應他的ASP程式執行出錯，錯誤訊息如下，之前是正常的說msxml3.dll 錯誤 '800c000e'發生安全性問題。程式碼簡略如下Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")objXMLHTTP.Open "GET", URL, flaseobjXMLHTTP.setRequestHeader "Content-Type", "text/html"objXMLHTTP.setRequestHeader "charset", "big5"objXMLHTTP.send　剛好最近系統移轉，想說會不會是msxml3.dll沒裝，查了一下在 %windir%\system32下是有的，再用regsvr32重新註冊一下好了，結果錯誤還是一樣，難道要設安全性嗎?我倒是沒設過，想說去下載msxml3重裝，結果錯誤還是一樣</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6554138060585218004/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/08/msxml3dll-800c000e.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6554138060585218004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6554138060585218004'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/08/msxml3dll-800c000e.html' title='msxml3.dll 錯誤 &apos;800c000e&apos;'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6199291319101423285</id><published>2009-07-03T20:47:00.003+08:00</published><updated>2009-07-08T11:22:43.089+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><title type='text'>啟用IIS6隔離模式對CDO.Message的影響</title><summary type='text'>因為不明的原因造成IIS6常常重啟，不得已只好開啟隔離模式（用 IIS 5.0 隔離模式執行 WWW 服務），結果奇怪的事發生了，原本ASP可以發送mail的，突然不能發送，還有錯誤訊息，把隔離模式取消，就可以發送了，很怪吧(CDONTS也一樣，可參考我另一篇)程式如下Set objEmail = CreateObject("CDO.Message")objEmail.From = "寄件者"objEmail.To = "收件者"objEmail.Subject = "CDO.Message test"objEmail.Textbody = "test"objEmail.SendResponse.write "使用CDO.Message發信成功" 錯誤訊息CDO.Message.1 錯誤 '80040220'"SendUsing" (?C°e‥I￥I) 3]cw-EμLRA!C/</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6199291319101423285/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/07/iis6cdomessage.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6199291319101423285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6199291319101423285'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/07/iis6cdomessage.html' title='啟用IIS6隔離模式對CDO.Message的影響'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4426631550918081663</id><published>2009-07-02T23:27:00.003+08:00</published><updated>2009-07-08T11:23:41.848+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><title type='text'>啟用IIS6隔離模式對CDONTS.NewMail的影響</title><summary type='text'>先說win2003預設已不支援CDONTS.NewMail了，建議是用CDO.Message囉，但若還是堅持要用，請自行從別台機器拷貝cdonts.dll然後再註冊就可使用！因為不明的原因造成IIS6常常重啟，不得已只好開啟隔離模式（用 IIS 5.0 隔離模式執行 WWW 服務），結果奇怪的事發生了，原本ASP可以發送mail的，突然不能發送，還有錯誤訊息，把隔離模式取消，就可以發送了，很怪吧 (CDO.Message也是，可參考)程式如下Set objEmail = CreateObject("CDONTS.NewMail")objEmail.From = "寄件者"objEmail.To = "收件者"objEmail.Subject = "CDONTS.NewMail test"objEmail.body = "test"objEmail.SendResponse.write "</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4426631550918081663/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/07/iis6cdontsnewmail.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4426631550918081663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4426631550918081663'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/07/iis6cdontsnewmail.html' title='啟用IIS6隔離模式對CDONTS.NewMail的影響'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6351793912539276910</id><published>2009-06-29T20:40:00.006+08:00</published><updated>2009-06-29T21:01:21.722+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BitComet'/><title type='text'>BitComet黃燈阻塞的解決辦法</title><summary type='text'> 1.先確定選項裡有監聽Port，打開防火牆，及映射囉2. 再確認防毒軟體有沒有檔BitComet，有的會檔，自己去檢查一下，我自己用小紅傘是沒檔啦3.重點來囉，如果確認過前兩步驟還是沒變綠燈的話，我猜你的情況應該與我相同，就是有用IP分享器的關係，只要設定一下虛擬伺服器就ok啦，記得內外部的Port要跟BitComet裡監聽Port一樣的就行啦 4. 重開BitComet就變綠燈啦 </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6351793912539276910/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/06/bitcomet.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6351793912539276910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6351793912539276910'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/06/bitcomet.html' title='BitComet黃燈阻塞的解決辦法'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/Ski3Hx36cEI/AAAAAAAAAG0/iQ6Nir6D1Zc/s72-c/yellow.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4692451120882661895</id><published>2009-05-06T20:09:00.001+08:00</published><updated>2009-05-06T22:01:34.202+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>交易記錄檔備份失敗</title><summary type='text'>今天收到"資料庫維護計劃-交易記錄檔備份"竟然失敗的訊息，真是詭異，因為是第一次看到，更詭異的是看作業的錯誤訊息竟然看不出所以然，如下：以下列使用者的身分執行: Domain\administrator。 sqlmaint.exe 失敗。 [SQLSTATE 42000] (錯誤 22029). 步驟失敗。看那錯誤我誤以為那身分是不是帳密有改過， 問我們MIS確定是沒有的，只好上網查，原來真正錯誤訊息要去看維護計劃歷程記錄中失敗的項目，才找到原因，原來是我早上動到某個資料庫的復原模式的關係啊</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4692451120882661895/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/05/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4692451120882661895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4692451120882661895'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/05/blog-post.html' title='交易記錄檔備份失敗'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1409782683358207259</id><published>2009-04-19T14:08:00.002+08:00</published><updated>2009-04-23T14:53:09.121+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><title type='text'>DTS的工作順序也許不是你想的那樣</title><summary type='text'>之前設計DTS時，通常是每各轉換資料工作，有自己獨立的來源與目的地，然後一個轉換資料工作執行成功後，才作下一各轉換資料工作，中間用成功串連起來，結果昨天偷懶一下，試著兩個工作共用同一個來源與目的地，如下圖 原本以為執行的順序是[4002SQL1(1)]跟[4002SQL2(3)]都執行成功了，才執行[SQL2TXT3(2)]的，結果不是，如下圖 竟然[SQL2TXT3(2)]比[4002SQL(3)]早執行，要是[SQL2TXT3(2)]的工作，其中有資料是要靠[4002SQL2(3)]來傳輸的，那不就會有問題了嗎?早知道就不要偷懶，乖乖一個一個的分開設比較安全！後來發現，應該是我成功的工作流程屬性沒特別設定優先順序造成的，我從沒特別去設它...@@...如下圖以至於[4002SQL1(1)]完就接著作[SQL2TXT3(2)]，所以那我再加入另一各步驟進來 執行後，終於跟我想的一樣了!</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1409782683358207259/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/04/dts.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1409782683358207259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1409782683358207259'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/04/dts.html' title='DTS的工作順序也許不是你想的那樣'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hxLURPv9dV8/Se61kDwE8wI/AAAAAAAAAGE/eD7hwdoLIRM/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-371430062780837671</id><published>2009-04-18T10:30:00.004+08:00</published><updated>2010-08-25T11:49:31.554+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Batch'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><title type='text'>列出FTP虛擬目錄</title><summary type='text'>根據IIS的說明主題裡有提到
下列命令是顯示Test Downloads FTP 站台之根目錄中的虛擬目錄
iisftpdr /query "Test Downloads"
Alias　Physical Root
=====================
/Scripts 　C:\Libraries\Scripts
下列則是顯示 Scripts 虛擬目錄的 VBScripts 子目錄。
iisftpdr /query "Test Download"\Scripts
Alias　Physical Root
=====================
/VBScripts　D:\Scripts\VBScripts
也提到
/query 操作只顯示虛擬目錄而不顯示實體目錄。此外，它只顯示 FTP 站台之根目錄中的虛擬目錄或路徑，而不遞迴搜尋。
那我想要遞迴怎麼辦?只好自己寫成script囉
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/371430062780837671/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/04/ftp.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/371430062780837671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/371430062780837671'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/04/ftp.html' title='列出FTP虛擬目錄'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2395815057194233256</id><published>2009-04-01T20:07:00.006+08:00</published><updated>2009-04-02T16:51:04.799+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>如何在 SQL Server 的執行個體之間傳送登入和密碼</title><summary type='text'>不管是要移動或是複製資料庫到不同版本的Server上，登入與密碼的傳送就很重要，可參考KB246133，建立 sp_help_revlogin 預存程序後，執行下列陳述式，用以產生原始 SID 和密碼的登入指令EXEC master..sp_help_revlogin注意kb246133裡有寫適用於下列案例：將登入和密碼從 SQL Server 7.0 傳送至 SQL Server 7.0。 將登入和密碼從 SQL Server 7.0 傳送至 SQL Server 2000。 將登入和密碼從 SQL Server 7.0 傳送至 SQL Server 2005。 在執行 SQL Server 2000 的伺服器之間傳送登入和密碼。 將登入和密碼從 SQL Server 2000 傳送至 SQL Server 2005。若你誤以為在SQL Server 2005 間傳送登入和密碼也是行的</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2395815057194233256/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/04/sql-server.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2395815057194233256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2395815057194233256'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/04/sql-server.html' title='如何在 SQL Server 的執行個體之間傳送登入和密碼'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1820992177941131551</id><published>2009-03-28T11:56:00.001+08:00</published><updated>2009-04-02T13:30:07.099+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='系統錯誤'/><title type='text'>無法取消列印</title><summary type='text'>送出列印後，發現印表機沒反應，打開印表機佇列，發現有文件卡住，想取消又刪除不掉，一直停在"刪除 - 列印"狀態，通常只能重開機囉 後來發現其實有不用重開機的方法，將以下的script存del_print_Doc.bat，再執行即可，我測試過真的有效喔@echo off::停止印表機服務echo 正在停止印表機服務...Net Stop spoolerecho.::清除所有列印的佇列echo 正在清除所有列印佇列...echo y del %systemroot%\system32\spool\printers\*.*::重新啟動印表機服務echo.echo 正在啟動印表機服務...Net Start Spoolerecho.echo 您再開啟印表機將看到佇列資料已經被清空喔echo 請 按 任 意 鍵 繼 續 ...pause &gt;nul</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1820992177941131551/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/03/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1820992177941131551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1820992177941131551'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/03/blog-post.html' title='無法取消列印'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4479620770500471434</id><published>2009-03-04T21:49:00.015+08:00</published><updated>2009-03-05T13:44:21.450+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>550 5.7.1 Unable to relay</title><summary type='text'>使用JAVAMAIL寄信，結果出現下列錯誤javax.mail.SendFailedException: Invalid Addresses;nested exception is:class javax.mail.SendFailedException: 550 5.7.1 Unable to relay意思就是你的mail server不允許你經由它寄送外部郵件，寄送內部郵件應該沒問題啦，反正應該是驗證的問題囉，不是你程式裡沒有設定要驗證，就是mail server不讓你驗證，所以請檢查發送mail的程式裡有沒有啟用驗證囉，有啟用通常會用到帳號密碼囉，不過像我的情況是，該系統被加入relay清單裡，exchange似乎強制不讓我驗證，就算程式有驗證也沒用，解決辦法就是請管理者幫你把該系統從relay清單移除，然後AP server記得重啟或AP重新部署，有時不這麼作，會有cache</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4479620770500471434/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/03/550-571-unable-to-relay.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4479620770500471434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4479620770500471434'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/03/550-571-unable-to-relay.html' title='550 5.7.1 Unable to relay'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4336237011362487852</id><published>2009-02-26T19:49:00.005+08:00</published><updated>2009-02-27T19:57:37.036+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='系統錯誤'/><title type='text'>Windows Installer並未正確安裝或windows update無法更新</title><summary type='text'>公司的網管反應有台測試機win 2000 server，常常中毒，我當時用掃毒程式掃了也沒事，但是過幾天後去看，發現掃毒程式每天不定時都會反應掃到一個病毒BAT_FTPER.C，我再想是不是太久沒windows update了，於是就去更新一下，結果失敗...@@想裝MBSA看看好了，因為MBSA也會告訴你有哪些更新沒裝，結果跳出下列訊息無法存取Windows Installer可能是Windows處於安全模式 或是Windows Installer並未正確安裝請聯絡您的支援人員解決辦法1.若要解決windows update無法更新的問題　a. 安裝Windows Installer 3.0 Redistributable 　b. 重新開機後，就可以正常更新了2.若要解決Windows Installer並未正確安裝的問題　regsvr32 %systemroot%\system32\</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4336237011362487852/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/windows-installerwindows-update.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4336237011362487852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4336237011362487852'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/windows-installerwindows-update.html' title='Windows Installer並未正確安裝或windows update無法更新'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1197451546367266763</id><published>2009-02-22T21:53:00.002+08:00</published><updated>2009-02-24T19:56:01.400+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>刪除七天前無效的連線</title><summary type='text'>最近有台SQL Server的CPU使用率常常飆高，觀察似乎是連線的數量太多了，有很多連線是程式使用完沒有close的關係，短時間人手不足，沒法修正程式，只好手動清除啦，不過一個一個清太累囉，還是寫段陳述式來清囉DECLARE @spid int, @SQLstr nvarchar(128)--僅針對某個登入來清理囉，所以請自行更換"使用者"DECLARE spids_cr CURSOR FORSELECT sp.spid FROM master..sysprocesses spLEFT OUTER JOIN master..sysdatabases sd ON sd.dbid = sp.dbidWHERE sp.loginame='使用者' AND sp.net_address&lt;&gt;''and sp.last_batch &lt;= DATEADD(dd,-7,getdate())  OPEN</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1197451546367266763/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1197451546367266763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1197451546367266763'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/blog-post.html' title='刪除七天前無效的連線'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1316098053476796709</id><published>2009-02-12T21:22:00.006+08:00</published><updated>2010-08-23T14:11:55.253+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><category scheme='http://www.blogger.com/atom/ns#' term='VB Script'/><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>SMTP  550 5.7.1 not  permissions as this sender</title><summary type='text'>如果寄信失敗，結果回傳錯誤碼550 5.7.1 ，錯誤訊息跟下面三種情況一樣的話，表示你使用的發信伺服器，有限制寄件者需與帳號一致喔，意思就是若用我的帳號發信，寄件者就不能設成別人，請檢查你的程式寄件者是不是設的與帳號不同！一般發信若是使用SMTP services來寄信是不會有這種困擾的，因為寄件者就算設不存在的也照樣可以寄！



1 VB Script的錯誤



2.Outlook Express的錯誤
 3.JAVA的錯誤
500 Servlet Exception
javax.mail.MessagingException: 550 5.7.1 Client does not have permissionsto send as this sender
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1316098053476796709/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/smtp-550-571-not-permissions-as-this.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1316098053476796709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1316098053476796709'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/smtp-550-571-not-permissions-as-this.html' title='SMTP  550 5.7.1 not  permissions as this sender'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hxLURPv9dV8/SZUnw0PcsbI/AAAAAAAAAF0/FQoRHgfoOB8/s72-c/mailerror.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6078928065919595354</id><published>2009-02-11T20:29:00.001+08:00</published><updated>2009-02-16T14:59:37.621+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>JAVAMAIL範例2(不需認證的smtp)</title><summary type='text'>這個blogger不允許直接貼上完整的jsp程式碼囉，所以我只列出主要的，記得"&lt;"與"%"還有"%"跟"&gt;"是沒有空白的喔&lt; % @page import="java.util.*" % &gt;&lt; % @page import="javax.mail.*" % &gt;&lt; % @page import="javax.activation.*" % &gt;&lt; % @page import="javax.mail.internet.*" % &gt;&lt; % String host = "127.0.0.1";String receiver = "收件人";String sender = "發信人";String subject = "主旨";String mess = "內文success";boolean sessionDebug = false;Properties prop = new </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6078928065919595354/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/javamail2smtp.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6078928065919595354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6078928065919595354'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/javamail2smtp.html' title='JAVAMAIL範例2(不需認證的smtp)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4952223577050452024</id><published>2009-02-10T19:52:00.002+08:00</published><updated>2009-02-24T09:33:35.010+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><category scheme='http://www.blogger.com/atom/ns#' term='SMTP'/><title type='text'>JAVAMAIL範例1(需要認證的smtp)</title><summary type='text'>最近mail server升級，結果部分系統的發信機制出了問題，所以需要簡單的範例程式來測一下，但是我不會java，只好上網稍微研究了一下囉，簡單的code卻花了我不少時間研究，分享給有需要的朋友，這個blogger不允許直接貼上完整的jsp程式碼囉，所以我只列出主要的，記得"&lt;"與"%"還有"%"跟"&gt;"是沒有空白的喔&lt; % @page import="java.util.*" % &gt;&lt; % @page import="javax.mail.*" % &gt;&lt; % @page import="javax.activation.*" % &gt;&lt; % @page import="javax.mail.internet.*" % &gt;String host = "發信伺服器";String receiver = "收件者";String sender = "寄件者";String subject =</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4952223577050452024/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/javamail1smtp.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4952223577050452024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4952223577050452024'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/javamail1smtp.html' title='JAVAMAIL範例1(需要認證的smtp)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8140906740434012531</id><published>2009-02-05T21:12:00.005+08:00</published><updated>2009-02-09T10:25:27.263+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Batch'/><title type='text'>FINDSTR進階用法</title><summary type='text'>想搜尋大量文字檔裡的字串，建議FINDSTR一定要學會用，很方便的喔，我這幾天才知道原來有支援一般表示式呢，使用起來更加強大喔A.利用/G從指定的檔案取得搜尋字串清單(按我看一下會更了解這怎麼用) 　　請把下列的"&amp;"替換成shift+\囉，也就是一條直線的管道符號(因blogger把我字給吃了)findstr /s /i /G:search.txt d:\*.asp &amp; findstr /v /i /G:exclude.txt &gt; c:xx.log其中 search.txt 是搜尋字串所在的檔案，d:\*.asp加/s是要搜尋D槽下所有asp的檔案，exclude.txt 是要排除的搜尋字串所在的檔案，xx.log則存放搜尋結果。B.使用一般表示式(Regular Expression)　以下是FINDSTR所支援的中繼字元，雖沒有很多，但我覺得很夠用囉　0.跟著我一起練習，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8140906740434012531/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/findstr.html#comment-form' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8140906740434012531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8140906740434012531'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/findstr.html' title='FINDSTR進階用法'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hxLURPv9dV8/SYqvpqgLhVI/AAAAAAAAAFs/zjdjPWrm5z8/s72-c/d.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2296205575836965152</id><published>2009-02-04T21:47:00.002+08:00</published><updated>2009-02-09T10:28:37.908+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Batch'/><title type='text'>FOR語句的應用</title><summary type='text'>可能很多人不知道在Batch裡也有迴圈可以運用喔，我個人覺得這功能非常強大，雖然我只會簡單的，但有時可幫助我節省不少工作時間呢！　　可在命令列下"for /?"得到詳細資訊喔0.基本應用(沒有啟用擴充命令)　就是手動去指定迴圈範圍，語句如下 　FOR %variable IN (set) DO 指令 [command-parameters]　例子1：如何快速找出硬碟CDE槽的剩餘可用空間 。　語句1： 請把&amp;替換成shift+\囉(blogger把我字給吃了)for %i in (c d e) do @dir %i: &amp; find "位元組可用"　22 個目錄 6,034,595,840 位元組可用　15 個目錄 1,634,000,896 位元組可用　8 個目錄 3,506,417,664 位元組可用　補充1：@ 只是讓輸出結果不包括 dir命令本身而已　例子2：</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2296205575836965152/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/for.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2296205575836965152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2296205575836965152'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/for.html' title='FOR語句的應用'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4239380729174107376</id><published>2009-02-04T19:49:00.000+08:00</published><updated>2009-02-04T19:49:50.123+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VNC'/><title type='text'>RealVNC的小技巧</title><summary type='text'>這兩個小技巧，知道的人似乎不多，分享給各位囉1.如何同時允許兩個連線連入，也就是先連入的不會被後來連入的給斷線喔　a .執行VNC Viewer後，先不要急著按[OK]，先按[Options]　 b .在VNC Viewer Options的設定畫面，先切換到[Misc]頁籤，將[Shared connection]打勾，然後就可以按下[確定]，預設是不會打勾的，所以預設是後連入的會把先連入的給斷線囉　c.就這各設定，很簡單吧2.VNC如何像遠端桌面一樣，可以一台存成一個捷徑，下次直接點選捷徑就幫你連入呢？用batch就可以達成囉，將下列兩行存成server1.bat，自行替換IP位址囉，也很簡單cd "C:\Program Files\RealVNC\VNC4\"start vncviewer.exe 10.122.2.12</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4239380729174107376/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/realvnc.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4239380729174107376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4239380729174107376'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/realvnc.html' title='RealVNC的小技巧'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/SYlfdjT-g8I/AAAAAAAAAFE/sZ6NuoFRNes/s72-c/1.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-8716214342364104026</id><published>2009-02-03T20:28:00.003+08:00</published><updated>2011-07-27T17:15:16.414+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>自訂sp_who2加強版</title><summary type='text'>　　最近遇到有台DB主機的CPU使用率常常滿載，觀察DB的活動監視器，發現有過多Connection似乎沒有colse，這是不好的現象，那得先找出相關的是哪些Connection囉，SQL 2000本身只提供sp_who與sp_who2這兩個遇存程序來觀察，但都沒提供相關Connection的陳述式的資訊，總不可能再一個一個透過DBCC INPUTBUFFER來查吧，先上網找找有沒有人寫好的加強版，有是有啦，不過不是很合自己用，那就自己來自訂一個吧

--只適用SQL 2000，若要用在2005以後版本請看最後一行
USE [master]
GO
IF object_id('sp_who3') IS NOT NULL
BEGIN
DROP PROC sp_who3
END
GO

CREATE PROC [dbo].[sp_who3]
@loginame sysname = NULL
</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/8716214342364104026/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/02/spwho2.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8716214342364104026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/8716214342364104026'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/02/spwho2.html' title='自訂sp_who2加強版'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-2232384197409570075</id><published>2009-01-18T08:30:00.002+08:00</published><updated>2009-02-06T11:34:43.113+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><title type='text'>AS400如何透過DTS轉入SQL Server2000</title><summary type='text'>剛好同事問有沒有文件，想說順便寫一下設定步驟好囉！ 1.請確定在你執行的那台server上已裝好Client Access囉，如果你想在Client端也能用，那Client端也要裝!2-1.裝好後我通常是先設定ODBC啦，再[開始][執行]那邊輸入odbcad32，這邊之後再設也行2-2. 然後在[ODBC資料來源管理員]畫面的[系統資料來名稱]頁籤，按下[新增] 2-3.在[建立新資料來源]畫面，選取[iSeries Access ODBC Driver]，按下[完成 ]2-4.在[iSeries Access for Windows ODBC設定]畫面的[一般]頁籤，設定[資料來源名稱]，名稱看你想設定什都可，與[系統]的ip位址，也就是AS400的位置2-5. 切換到[伺服器]頁籤，設定[SQL的預設檔案庫]，也就是AS400的Library囉，如果有多個的話，是設在下面的[</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/2232384197409570075/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/as400dtssql-server2000.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2232384197409570075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/2232384197409570075'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/as400dtssql-server2000.html' title='AS400如何透過DTS轉入SQL Server2000'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hxLURPv9dV8/SXZtfSPRyfI/AAAAAAAAAEE/Lxsu8mjpUJY/s72-c/0.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1440361539963849371</id><published>2009-01-16T20:35:00.001+08:00</published><updated>2009-01-17T14:30:45.733+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Batch'/><title type='text'>批次檔的執行條件處理IF</title><summary type='text'>IF在批次檔中大概有3種格式，我配合我用過的例子作說明，如下：1. IF [NOT] 參數==字串 command參數如果等於指定的字串，則條件成立，就會運行命令例子1：我有一個批次檔，每天排程執行，當遇到週日我想執行不一樣的命令， 內容要怎麼寫？::取日期與星期幾for /f "tokens=1,2" %%i in ('date /T') do set vard=%%i&amp;&amp; set vare=%%j::判斷是否週日，如果是週日跳到另一段落if %vare%==星期日 goto addsun::下面執行非週日的命令echo 執行非週日命令exit::下面執行週日的另令:addsunecho 執行週日命令例子2：各位都知道windows排定的工作是可以細到每分鐘的執行一次的，那如果我排定一個批次檔是每天的九點開始執行，每小時執行一次，直到下午五點，批次檔會寫記錄到Log中，這樣排定，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1440361539963849371/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/if.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1440361539963849371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1440361539963849371'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/if.html' title='批次檔的執行條件處理IF'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1472891214218763232</id><published>2009-01-13T22:36:00.008+08:00</published><updated>2011-04-27T13:54:04.740+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB Script'/><title type='text'>自動刪除七日前的檔案</title><summary type='text'>最近剛好需要，上網有找到例子，可是沒法直接用，會出錯，只好再參考指令碼存放庫的sample，改了後終於可以用了，分享給大家囉！

下面這個例子是會刪除在c:\Downloads下7天前所建立，然後副檔名為txt文字檔囉，請複製後存成vbs的檔案就可以了，也可以用在DTS裡的ActiveX Script喔

'設定幾天前
beforDay = 7
'設定磁碟
strDisk = "C:"
'設定路徑
strPath = "\\Downloads\\"
'指定副檔名
strExFileName = "txt"

strComputer = "."
strDate = Date - beforDay
Set objWMIService = GetObject _
("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")
Set colFiles = </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1472891214218763232/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/blog-post_13.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1472891214218763232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1472891214218763232'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/blog-post_13.html' title='自動刪除七日前的檔案'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5273305057159892047</id><published>2009-01-13T20:43:00.003+08:00</published><updated>2009-01-14T13:58:09.286+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>執行sp_helpdb發生錯誤</title><summary type='text'>最近遇到一個問題，就是在Query Analyzer執行sp_helpdb出現下列錯誤伺服器: 消息 515，級別 16，狀態 2，過程 sp_helpdb，行 53無法將 NULL 值插入列 'owner'，表 'tempdb.dbo.#spdbdesc___________________________________________________________________________________________________________00010000001F'；該列不允許空值。INSERT 失敗。然後執行第二次時又出現伺服器: 消息 515，級別 16，狀態 2，過程 sp_helpdb，行 53無法將 NULL 值插入列 ''，表 ''；該列不允許空值。INSERT 失敗。當時想說，這不是系統內建的嗎?怎麼會出錯呢?怪的是，若我用"sp_helpdb </summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5273305057159892047/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/sphelpdb.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5273305057159892047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5273305057159892047'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/sphelpdb.html' title='執行sp_helpdb發生錯誤'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-7479800579059706450</id><published>2009-01-11T21:46:00.004+08:00</published><updated>2010-08-27T14:28:26.836+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>使用[查閱]轉換的注意事項</title><summary type='text'>SQL Server 2005線上叢書說："依預設，查閱轉換會將整個參考資料表放在記憶體的快取中，以提供最佳的效能。如果您未選取 [進階] 索引標籤上的任何選項，查閱轉換就會使用此預設行為。如果有記憶體限制，[進階] 索引標籤上的選項可讓您只設定部份快取。"


也就是說SSIS預設是幫你開啟快取的，這跟2000的DTS剛好相反喔，自己拉一個[查閱]轉換來看看囉，如上圖，屬性的CacheType預設是用完整快取的喔！各位看圖上似乎有三個選擇，這各部分線上叢書裡也有提到
參考資料集所需的記憶體可利用下列方式配置：
全部預先快取，如此會在處理輸入之前先讀取完整的參考資料集。
部份快取，轉換會指定隨參考資料載入的快取大小。此選項只有在使用支援索引鍵存取的連接時才提供。 
無快取，如此會按照資料列集中的各資料列存取參考資料集。 
1.全部預先快取：預設是這個選項，預先幫你開快取，感覺很好，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/7479800579059706450/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/blog-post_11.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7479800579059706450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/7479800579059706450'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/blog-post_11.html' title='使用[查閱]轉換的注意事項'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hxLURPv9dV8/SWr4zMmEJoI/AAAAAAAAAD8/f8pOP6E7m48/s72-c/2.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-5345524340224453072</id><published>2009-01-10T22:14:00.003+08:00</published><updated>2010-08-27T14:29:45.696+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>[OLE DB來源]請使用"SQL 命令"來取得資料</title><summary type='text'>

最近在參考一些SSIS效能調教的文章，有提到說在使用[OLE DB來源]時，資料存取模式使用[SQL 命令]的效能會比使用[資料表或檢視]來的好

經過自己實際測量的結果，從[OLE DB來源]轉到[SQL Server目的地]，傳輸263萬筆的資料，使用[SQL 命令]的執行時間大約3:46，而使用[資料表或檢視]的執行時間大約4:00，有縮短14秒耶，所以使用[SQL 命令]真的有比較好喔 

另外，有提到若都在同一台SQL Server上執行，使用[SQL Server目的地]的效能會比[OLE DB目的地]來的好，我個人實測其實差不多耶，不過如果可以，還是乖乖用[SQL Server目的地]好了，也許真的有差</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/5345524340224453072/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/ole-dbsql_10.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5345524340224453072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/5345524340224453072'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/ole-dbsql_10.html' title='[OLE DB來源]請使用&quot;SQL 命令&quot;來取得資料'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hxLURPv9dV8/SWrR9A2zlHI/AAAAAAAAADs/Ziuqb2zlpVY/s72-c/0.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-4890635013043157830</id><published>2009-01-09T23:56:00.001+08:00</published><updated>2009-01-12T13:33:39.122+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>[SQL server目的地]的逾時時間</title><summary type='text'>這好像是個bug，逾時預設是30秒，如果不更改為0，也就是不限制時間的話，有時執行會遇到莫名的錯誤說，我更改為0後，就正常很多了，給各位參考一下</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/4890635013043157830/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/sql-server.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4890635013043157830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/4890635013043157830'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/sql-server.html' title='[SQL server目的地]的逾時時間'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-6690863027235196456</id><published>2009-01-08T20:51:00.000+08:00</published><updated>2009-01-10T14:46:27.456+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>奇怪的CHECKSUM函數</title><summary type='text'>最近剛好在研究SSIS，想說如何做到當資料有異動時去更新資料，上網查到一篇文章Using a checksum to determine if a row has changed，我才知道原來有CHECKSUM這個函數啊這個函數有趣的地方是，它會針對你給的資料清單，清單可以是資料行，然後產生一組湊雜(hash)值，線上叢書這麼稱呼的啦，比如說SELECT CHECKSUM('a1','adalf') --256163607SELECT CHECKSUM('al','adalf')--1620787439看到沒，如果給的值不相同，產生的湊雜值也不同用這個值當索引，就可以當湊雜索引囉用這個值當作比較，也可以用來判斷資料是否不一樣，不一樣就需要更新那我就想到也許可以拿來當作unique index啊如果原本索引欄位很長，透過這個轉變索引成數值欄位，</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/6690863027235196456/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/checksum.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6690863027235196456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/6690863027235196456'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/checksum.html' title='奇怪的CHECKSUM函數'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1197963725021640715.post-1544037285092660010</id><published>2009-01-07T21:32:00.000+08:00</published><updated>2009-01-09T15:17:25.979+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>AS400要怎樣才能轉入SQL Server 2005呢?(二)</title><summary type='text'>先參考AS400要怎樣才能轉入SQL Server 2005呢?(一)，了解一下，然後確認已經在Server上裝好Client Access 囉，我這邊指講資料來源是AS400時要怎麼設定喔，只針對SSIS的部分，如果你用的是SSMS的匯入匯出精靈，來源端的設定也大同小異啦，只是畫面長的不一樣而已囉1.在[連接管理員]下方的空白處按右鍵，選擇[新增OLE DB連接]2.在[設定OLE DB連接管理員]的設定畫面，按下[新增]3.在[連接管理員]的設定畫面，在[提供者]旁的下拉選單 選擇IBMDA400的那個囉，然後按下[確定]4. 然後在[伺服器名稱或檔名]那邊輸入AS400的ip，在使用者名稱及密碼那邊輸入連線到AS400用的帳號密碼囉，通常[允許儲存密碼]我會打勾，[初始資料庫目錄]不需設定，留空即可，很多人會誤以為這要填LIBRARY，LIBRARY是在後面才設定的，這跟設ODBC</summary><link rel='replies' type='application/atom+xml' href='http://adalf0722.blogspot.com/feeds/1544037285092660010/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://adalf0722.blogspot.com/2009/01/as400sql-server-2005_07.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1544037285092660010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1197963725021640715/posts/default/1544037285092660010'/><link rel='alternate' type='text/html' href='http://adalf0722.blogspot.com/2009/01/as400sql-server-2005_07.html' title='AS400要怎樣才能轉入SQL Server 2005呢?(二)'/><author><name>adalf</name><uri>http://www.blogger.com/profile/04893446985065745007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hxLURPv9dV8/SWbkxIbFqVI/AAAAAAAAACc/IQ6FARe-N4Y/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
