问题
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