如何使用表值参数(TVP)摆脱SQL Profiler例外208
我确实搜索了SQL Profiler标识的异常208(无效对象名称),并找到了许多有关“延迟名称分辨率”的提示。尽管如此,我仍然找不到与TVP(表值参数)和SQL Server 2019相关的ASNWER。
我将要迁移一个从SQL Server 2016到SQL Server 2019的应用程序,我想知道为什么Profiler开始抛出的hunrets每小时具有相同代码的例外。事实证明,所有这些都是例外208(无效的对象名称)。
繁殖步骤: 将数据库的兼容性级别设置为140(2017); SSM和Profiler均无例外。
将数据库的兼容性级别设置为150(2019); SSM运行良好,但SQL Profiler抛出异常208(无效的对象名称)。
有什么方法可以摆脱这种情况吗?如果我正在寻找数据库中的任何意外例外,则由于许多无用的例外,我会失明。
--ALTER DATABASE [...] SET COMPATIBILITY_LEVEL = 140;
ALTER DATABASE [...] SET COMPATIBILITY_LEVEL = 150;
GO
CREATE TYPE dbo.LocationTableType AS TABLE ( LocationName VARCHAR(20) );
GO
DECLARE @LocationTVP AS dbo.LocationTableType;
SELECT * FROM @LocationTVP; -- Throws the exception in profiler
--INSERT INTO @LocationTVP (LocationName) SELECT 'MyLocation'; -- Throws the exception in profiler
GO
DROP TYPE dbo.LocationTableType;
GO
插入或选择语句正在抛出异常。谁能让我知道如何在SQL-Server 2019中将其关闭,以便能够进一步使用SQL Profiler。
I did search for exception 208 (invalid object name) identified by SQL Profiler and found many hints regarding "Deferred Name Resolution". Nevertheless I still did not find an asnwer related to TVP (table valued parameter) and SQL Server 2019.
I´m going to migrate an application from SQL Server 2016 to SQL Server 2019 and I´m wondering why Profiler is starting throwing of hundrets of exceptions per hour with same code. It turned out that all of them are Exception 208 (invalid object name).
Steps for reproduction:
Set compatbility level of database to 140 (2017);
SSMS as well as Profiler runs without any exception.
Set compatbility level of database to 150 (2019);
SSMS runs fine but SQL Profiler throws exception 208 (invalid object name).
Is there any way to get rid of this? If I´m looking for any unexpected exceptions in database I get blind due to that many useless exceptions.
--ALTER DATABASE [...] SET COMPATIBILITY_LEVEL = 140;
ALTER DATABASE [...] SET COMPATIBILITY_LEVEL = 150;
GO
CREATE TYPE dbo.LocationTableType AS TABLE ( LocationName VARCHAR(20) );
GO
DECLARE @LocationTVP AS dbo.LocationTableType;
SELECT * FROM @LocationTVP; -- Throws the exception in profiler
--INSERT INTO @LocationTVP (LocationName) SELECT 'MyLocation'; -- Throws the exception in profiler
GO
DROP TYPE dbo.LocationTableType;
GO
Either INSERT or SELECT statement is throwing an exception. Could anyone let me know how to turn this off in SQL-Server 2019 to be able to further use of SQL profiler.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论