我有一個SSIS數據流任務正在採取查找匹配的記錄,並將它們提供給一個OLE DB命令組件。當我運行它,我得到一個錯誤,指出:爲什麼OLE DB命令試圖更新模式?
Error: 0xC0202009 at Data Flow Task, OLE DB Command [28]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E14.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E14 Description: "Property cannot be added. Property 'MS_Description' already exists for 'dbo.d_date.d_date_key'.".
我的SQL是:
UPDATE d_date
SET company_year_period = ?,
company_quarter = ?,
company_year_quarter = ?,
company_quarter_year = ?,
company_first_day_of_week = ?,
company_last_day_of_week = ?,
is_company_holiday = ?,
company_special_event = ?,
is_us_holiday = ?,
us_special_event = ?,
is_canadian_holiday = ?,
canadian_special_event = ?,
is_mexican_holiday = ?,
mexican_special_event = ?
WHERE d_company_key = ?
AND calendar_date = ?
爲什麼這個組件/簡單的更新與擴展屬性搞亂?!?
要完成這裏是我創建表時使用的代碼。
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Primary key for the d_date table. While it is a surrogate key it never the less has the form yyyymmdd.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'd_date', @level2type=N'COLUMN',@level2name=N'd_date_key'
CREATE TRIGGER d_date_update ON d_date
AFTER UPDATE
AS
UPDATE d_date
SET last_update = GETDATE()
WHERE d_date_key IN (SELECT DISTINCT d_date_key FROM Inserted)
;
我有一個表,d_date,以及每個柱MS_Description的擴展屬性。該表中填充了2558個日期記錄。我有第二個沒有擴展屬性的工作表。它也填充了一些稍微不同的記錄。下面的更新失敗:
UPDATE dd
SET dd.company_year_period = wdd.company_year_period,
dd.company_quarter = wdd.company_quarter,
dd.company_year_quarter = wdd.company_year_quarter,
dd.company_quarter_year = wdd.company_quarter_year,
dd.company_first_day_of_week = wdd.company_first_day_of_week,
dd.company_last_day_of_week = wdd.company_last_day_of_week,
dd.is_company_holiday = wdd.is_company_holiday,
dd.company_special_event = wdd.company_special_event,
dd.is_us_holiday = wdd.is_us_holiday,
dd.us_special_event = wdd.us_special_event,
dd.is_canadian_holiday = wdd.is_canadian_holiday,
dd.canadian_special_event = wdd.canadian_special_event,
dd.is_mexican_holiday = wdd.is_mexican_holiday,
dd.mexican_special_event = wdd.mexican_special_event
FROM d_date AS dd
LEFT JOIN working_d_date AS wdd ON wdd.d_company_key = dd.d_company_key
AND wdd.calendar_date = dd.calendar_date
(2558 row(s) affected)
Msg 15233, Level 16, State 1, Procedure sp_addextendedproperty, Line 37
Property cannot be added. Property 'MS_Description' already exists for 'dbo.d_date.d_date_key'.
最後的評論: 我正在這一切對我已經設置了使用試用許可證,我的工作站上SS2014企業。我不是DBA,所以我沒有正確設置一些東西的可能性很大。
我把所有的東西都搬到了我們的SS2008 R2服務器上,我沒有看到任何問題。這可能是2014年和2008年之間的問題,但更可能是2014年安裝中的某種設置問題。我會再次重溫,當我們正式安裝2014
這很奇怪,特別是在提供的代碼中不存在'd_date_key'。有沒有觸發器附在桌子上? – billinkc
我正在更新last_update列。 –
你會發布觸發器定義嗎?單擊編輯按鈕並將其修補到問題 – billinkc