Windows 8 + SQL 2012 (11.0.3128)
症頭是使用OPENROWSET導致SQL Server服務關閉。
select *
from OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;HDR=YES;IMEX=1;Database=c:\temp\ImportUsers.xlsx',
'select * from [Users$]')
查看事件檢視器,就這麼簡短的一行字
SQL Server (MSSQLSERVER) 服務意外地終止。已經發生 1 次。
另外還有項看不懂的Application Error
失敗的應用程式名稱: sqlservr.exe,版本: 2011.110.3128.0,時間戳記: 0x50deadad
失敗的模組名稱: ntdll.dll,版本: 6.2.9200.16579,時間戳記: 0x51637f77
例外狀況代碼: 0xc0000374
錯誤位移: 0x00000000000ebd59
失敗的處理程序識別碼: 0x61c
失敗的應用程式開始時間: 0x01cecd9d9186c411
失敗的應用程式路徑: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\sqlservr.exe
失敗的模組路徑: C:\Windows\SYSTEM32\ntdll.dll
報告識別碼: af519ed8-3991-11e3-be9a-0c6076872559
失敗的套件完整名稱:
失敗的套件相關應用程式識別碼:
同一個EXCEL檔轉成ImportUsers.xls使用SQL 2005讀取,卻沒有問題
select *
from OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;HDR=YES;IMEX=1;Database=c:\temp\ImportOrgnUsers.xls',
'select * from [Users$]')
找到這篇文章,解藥如下
EXEC master.dbo.sp_MSset_oledb_prop
N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
EXEC master.dbo.sp_MSset_oledb_prop
N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters',1
試了一下,執行 AllowInProcess即可解決。
順便查了一下何謂 AllowInProcess Anish Shenoy說到
AllowInProcess=0 (default)
Running the process outside the SQL Server Process:
Allowing the provider to run outside the SQL Server Process helps to protect the SQL Server process from errors in the provider, as when the provider runs outside the SQL Server process Updates or inserts involving column data types like (varchar(max), nvarchar(max), varbinary(max), text, ntext, or image) are not allowed.
AllowInProcess=1
Running the process inside the SQL Server Process:
By setting this option in the SQL Server providers, we will be able to handle the data types like (varchar(max), nvarchar(max), varbinary(max), text, ntext, or image) including long columns, image and text data.
In case of excel data we can see that when we import an excel data into the database tables without having predefined datatypes, by default the datatypes of some of the columns may be assigned to nvarchar(max) or ntext etc, so if we do net set the Allow Inprocess it will throw error.
這讓我順便抱怨一下,在SQL2012使用 撰寫SQL 指令 Import /Export資料時,在資料表對映無法解析到正確的資料類型 ,datatype 202 是什麼東西啊。
剛好也了解到原來這算是是一個BUG嗎?
nvarcahr 和varchar在SP1取消支援,改成了[DT_WSTR]和[DT_STR],把SSIS的定義套用在SSMS,真是很奇怪。
訂閱:
張貼留言 (Atom)
pdf.js 無法顯示部份字
有個檔案在pdf viewer套件中無法顯示內容,但下載檔案後使用工具又可以正常顯示。 本來以為是套件版本太舊的原因,於是去下載pdf viewer套件 https://github.com/mozilla/pdf.js 更新後還是一樣。 覺得應是字型缺漏的問題,於是用PDF-X...
-
上網找了免費的白箱檢測工具,找到了 puma scan 因為支援OWASP TOP 10的檢測,所以這是一個符合客戶需求又能與Visual studio結合的工具(白話說...交差了事矣....) 更重要的是這不用錢....檢測工具都貴森森的,尤其是源碼檢測工具。 ht...
-
建了一個工作排程,定時執行batch檔。 batch中寫了一段xcopy,主要針對有異動較新檔案時才複製。 echo off for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find...
-
.net 執行SQL指令時,出現以下錯誤。 已經開啟一個與這個 Command 相關的 DataReader,必須先將它關閉。 在web.config connectionstring 加入 "MultipleActiveResultSets=True...
沒有留言:
張貼留言