SQL Azure Schema Issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 22:05:48

问题


I'm getting an email regarding a Schema Issue on my SQL Azure Database and it reads something like this:

"Invalid column name 'False'" Error code : 207

However it doesn't appear to have any more information and I wouldn't even know where to start because the schema was created before I started in the project, but I suspect this is coming from a Stored Procedure or View.

This is all being reported in Azure Portal, but I have no idea how to proceed. Is there any other way to get the suggestions on Azure Portal in SSMS? I already tried Tuning Advisor and I got an error that SQL Azure was not supported.


回答1:


I use this query to to search objects in this scenario. This will find every occurrence of false and should help you find the offending column. This will find every occurrence of whatever you define @searchName as.

I found this on Pinal Dave's blog, way back. This works in Azure SQL.

declare @searchName varchar(50) = 'false'
select  @searchName as SearchName,
        OBJECT_SCHEMA_NAME(OBJECT_ID) + '.' +  OBJECT_NAME(OBJECT_ID) as ObjectName,
        [definition]
from sys.sql_modules
where definition LIKE '%' + @searchName + '%'
order by OBJECT_SCHEMA_NAME(OBJECT_ID) + '.' +  OBJECT_NAME(OBJECT_ID)


来源:https://stackoverflow.com/questions/42837191/sql-azure-schema-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!