Insert bulk failed due to a schema change of the target table
select
FiscalMonthID = (select FiscalMonthID from CurrentFiscalMonth (nolock)),
T.OrgKey,
DataSourceKey = 26,
OrganizationTypeKey = 2,
SourceSystemID = MAX(T.MbsId),
WEGFlag = convert(bit,0),
D.CreateDT,
D.CreateBy,
D.UpdateDT,
D.UpdateBy
from WorkDB.dbo.TempMbsOrgMap (nolock) as T
join WorkDB.dbo.MBSOrganization_Denorm2 (nolock) as D
on T.MbsId = D.OrganizationID
--where OrgKey not in (select OrgKey from OrgMap where FiscalMonthID=258 and DataSourceKey=26 and OrganizationTypeKey=2)
group by
T.OrgKey,
D.CreateDT,
D.开发者_JS百科CreateBy,
D.UpdateDT,
D.UpdateBy
I don't know whether this person ever got the problem resolved. If anyone else hits this error, the most helpful article I have found so far is: https://learn.microsoft.com/en-us/archive/blogs/sqlserverfaq/executing-bcp-fails-with-sqlstate-37000-nativeerror-4891-error-microsoftodbc-sql-server-driversql-serverinsert-bulk-failed-due-to-a-schema-change-of-the-target-table
The recommendations from the article (it's worth reading the whole thing though) are as follows:
Below is some of the action plan you can try, this helped in my case though.
Drop the Constraints before the BCP run and recreate them after the run
Disable the Auto update stats (To isolate the issue)
Check if any parallel index rebuilds happening.
If still the issue persists after implementing the above change, collect the Profiler trace to capture the activity when bcp is failing to further investigation.
精彩评论