简体   繁体   English

你调用的对象是空的。 (SqlMgmt) 同时使用 SSMS 向导更新扩展属性

[英]Object reference not set to an instance of an object. (SqlMgmt) while updating extended properties with SSMS wizard

While updating (Click on OK button, or Script on SSMS Wizard page), SSMS got Error: Object reference not set to an instance of an object.更新时(单击“确定”按钮或 SSMS 向导页面上的“脚本”),SSMS 收到错误:未将对象引用设置为对象的实例。 (SqlMgmt) (SqlMgmt) 点击错误!

错误的预先信息

Although there is no problem to do that action with system procedure (EXEC sys.sp_updateextendedproperty) and this will be execute successfully, but it seems that SSMS can't generate this action on wizard page (Stored Procedure Properties).虽然用系统过程(EXEC sys.sp_updateextendedproperty)做这个动作没有问题,而且会成功执行,但SSMS似乎无法在向导页面(存储过程属性)上生成这个动作。

  • I had reinstall SSMS on my local system, but it didn't worked!我已经在本地系统上重新安装了 SSMS,但是没有用!

  • Same Error exists on every local system of our client and developer that connect to this instance!连接到此实例的客户端和开发人员的每个本地系统上都存在相同的错误! and I believe that this is a problem on instance wide of server, not SSMS on client side.我相信这是服务器实例范围内的问题,而不是客户端的 SSMS。

  • There is no Problem for update extended properties from other Object (like Tables, Views, function, etc), but just Stored Procedure!从其他对象(如表、视图、函数等)更新扩展属性没有问题,但只是存储过程!

  • I think maybe there is some dirty records in some System Tables on the msdb Database!!!我想可能在 msdb 数据库上的某些系统表中有一些脏记录!!!

I solve it myself!我自己解决! The Problem was that I had an Extended Property with a NULL value on all my Stored Procedures!!!问题是我的所有存储过程都有一个带有 NULL 值的扩展属性!!!

So to solve this problem should update all of them and generate the Not NULL value for them.所以要解决这个问题,应该更新所有这些并为它们生成 Not NULL 值。

Below sample code will be update all the values of entire stored procedures that are exists with the NULL values in their extended properties (Just replace the YOUR_EXTENDED_PROPERTY_NAME with your own extended property name that have NULL value and should be update):下面的示例代码将更新存在于其扩展属性中的 NULL 值的整个存储过程的所有值(只需将YOUR_EXTENDED_PROPERTY_NAME替换为您自己的具有 NULL 值并应更新的扩展属性名称):

 DECLARE @Query AS NVARCHAR (MAX); DECLARE c CURSOR FOR ---------------------------------------------------- SELECT 'begin try EXEC sys.sp_updateextendedproperty @name=''YOUR_EXTENDED_PROPERTY_NAME'', @value='''' , @level0type=''SCHEMA'',@level0name=''' + schemaName + ''', @level1type=N''PROCEDURE'',@level1name=N''' + spname + ''' End try Begin catch End catch' FROM ( SELECT Ob.name spname, EX.name extended_name, sch.name AS schemaName, EX.value FROM sys.extended_properties AS EX JOIN sys.objects AS Ob ON Ob.object_id = EX.major_id JOIN sys.schemas AS sch ON sch.schema_id = Ob.schema_id WHERE Ob.type = 'P' AND EX.value IS NULL ) t; ---------------------------------------------------- OPEN c; FETCH NEXT FROM c INTO @Query; WHILE @@fetch_status <> -1 BEGIN EXECUTE sp_executesql @Query; FETCH NEXT FROM c INTO @Query; END; CLOSE c; DEALLOCATE c;

Question is that, why Microsoft let to insert the NULL value and then got ERROR Object reference not set to an instance of an object.问题是,为什么 Microsoft 允许插入 NULL 值,然后将 ERROR Object reference not set to an instance of an object. on them!!!在他们!!!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 你调用的对象是空的。 (SQLEditors) - Object reference not set to an instance of an object. (SQLEditors) {“你调用的对象是空的。”} - {“Object reference not set to an instance of an object.”} 你调用的对象是空的。 asp.net - Object reference not set to an instance of an object. asp.net 你调用的对象是空的。 阅读Excel - Object reference not set to an instance of an object. Reading Excel SqlConnection出现错误“对象引用未设置为对象的实例。” - Error “Object reference not set to an instance of an object.” for SqlConnection C#,SQL 2005,VS 2008中的“对象引用未设置为对象的实例。” - “Object reference not set to an instance of an object.” in C#, SQL 2005, VS 2008 System.NullReferenceException:&#39;对象引用未设置为对象的实例。 postsFile []为空 - System.NullReferenceException: 'Object reference not set to an instance of an object.' postedFile[] was null ConfigurationManager.ConnectionStrings Web.Config SQL凭据对象引用未设置为对象的实例。 错误 - ConfigurationManager.ConnectionStrings Web.Config SQL Credentials Object reference not set to an instance of an object. Error System.NullReferenceException: &#39;未将对象引用设置为对象的实例。&#39; 这里的问题是什么? - System.NullReferenceException: 'Object reference not set to an instance of an object.' What is the Issue here? pyodbc 发生阻止进一步处理此命令的内部错误:“对象引用未设置为对象的实例。” - pyodbc An internal error occurred that prevents further processing of this command: 'Object reference not set to an instance of an object.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM