Index was outside the bounds of the array. (Microsoft.SqlServer.Smo)

本地ssms是 安装Sqlserver 2008 r2 自带的

远端的server是sqlserver2014

可以连接,可以执行查询语句。但是,不能使用ssms生成对象的脚本。推测ssms 2008的内置命令与sqlserver2014不兼容。

错误:

1,

TITLE: Microsoft SQL Server Management Studio
------------------------------

Index was outside the bounds of the array. (Microsoft.SqlServer.Smo)

------------------------------
BUTTONS:

OK
------------------------------

触发方式:右击table和视图时

2,

===================================

Script failed for View 'v_type'.  (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Script+View&LinkId=20476

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects)
   at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(Urn[] urns, SqlSmoObject[] objects)
   at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns, SqlSmoObject[] objects)
   at Microsoft.SqlServer.Management.Smo.Scripter.EnumScript(Urn[] urns)
   at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ScriptGenerator.ScriptDrop(SqlTextWriter sqlwriter, Server server, Urn[] urns, SqlScriptOptions options)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ScriptNodeActionContext.Script(SqlTextWriter writer)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.SqlScriptMenu.OnScriptItemClick(Object sender, EventArgs e)

===================================

Index was outside the bounds of the array. (Microsoft.SqlServer.Smo)

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Smo.BitStorage.SetBit(Int32 itemIndex, BitIndex bitIndex, Boolean value)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AddObjectPropsFromDataReader(IDataReader reader, Boolean skipIfDirty, Int32 startColIdx, Int32 endColIdx)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AdvanceInitRec(SqlSmoObject currentSmoObject, XPathExpression levelFilter, Int32 filterIdx, IDataReader reader, Int32 columnIdx, Int32 columnOffset, Object[] parentRow, Boolean forScripting, List`1 urnList, Int32 startLeafIdx)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitObjectsFromEnumResultsRec(SqlSmoObject currentSmoObject, XPathExpression levelFilter, Int32 filterIdx, IDataReader reader, Int32 columnIdx, Object[] parentRow, Boolean forScripting, List`1 urnList, Int32 startLeafIdx)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AdvanceInitRec(SqlSmoObject currentSmoObject, XPathExpression levelFilter, Int32 filterIdx, IDataReader reader, Int32 columnIdx, Int32 columnOffset, Object[] parentRow, Boolean forScripting, List`1 urnList, Int32 startLeafIdx)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitObjectsFromEnumResultsRec(SqlSmoObject currentSmoObject, XPathExpression levelFilter, Int32 filterIdx, IDataReader reader, Int32 columnIdx, Object[] parentRow, Boolean forScripting, List`1 urnList, Int32 startLeafIdx)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitObjectsFromEnumResults(Urn levelFilter, IDataReader reader, Boolean forScripting, List`1 urnList, Int32 startLeafIdx, Boolean skipServer)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitChildLevel(Urn levelFilter, ScriptingOptions so, Boolean forScripting)
   at Microsoft.SqlServer.Management.Smo.Database.PrefetchObjects(ScriptingOptions options, IEnumerable`1 filters)
   at Microsoft.SqlServer.Management.Smo.Scripter.PrefetchDependencyCollection(DependencyCollection depList)
   at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(DependencyCollection depList, SqlSmoObject[] objects)
   at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects)

触发方式:右击对象(表,视图,存储过程,函数等等),查看其脚本(创建,修改,删除等等)时

3,

NameResultMessage
Getting the list of objects from 'mydb'.FailedMicrosoft.SqlServer.Management.Smo.UnknownPropertyException: Cannot read property ServerType.This property is not available on SQL Server 7.0. at Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

触发方式:通过 Generate and Publish Scripts 工具,导出创建脚本时

 

 

解决:

打sp1补丁,或者升级到sqlserver2014

 

http://mytecharticle.com/index-was-outside-the-bounds-of-the-array-microsoft-sqlserver-smo/

https://social.msdn.microsoft.com/Forums/azure/en-US/5ba2eafe-8943-41ad-82b6-79a9b591becb/sqlazuremw-error-index-was-outside-the-bounds-of-the-array-microsoftsqlserversmo?forum=ssdsgetstarted

转载于:https://www.cnblogs.com/yyjj/p/4205492.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 报错信息"IndexOutOfRangeException: Index was outside the bounds of the array."表示数组索引超出了数组的边界。这个异常通常发生在使用计数器作为数组索引时,计数器出错导致索引越界。\[1\]这并不是.Net的Bug,而是由于代码中的错误导致的异常。解决这个问题的方法是检查代码中的计数器是否正确,并确保在使用计数器作为数组索引时不会超出数组的边界。\[2\]在这种情况下,可能需要检查模型文件中的维度参数是否正确设置。\[2\]另外,也可以通过分析使用的onnx文件来解决这个问题。\[2\]根据报错邮件的内容,这个异常集中在某个方法中,可能需要仔细检查这个方法的代码,确保计数器的使用没有问题。\[3\] #### 引用[.reference_title] - *1* *3* [.Net多线程陷阱---Dictionary Index was outside the bounds of the array.](https://blog.csdn.net/ZF_TIAN_XIA/article/details/125916489)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Yolov5Net报错【已解决】:System.IndexOutOfRangeException: ‘Index was outside the bounds of the array.](https://blog.csdn.net/Zythonista/article/details/125594047)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值