Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress some warnings in SQL Server SSDT

In SQL Server Data Tools, I would like to suppress some, but not all, occurrences of SQL71502 ("--- has an unresolved reference to object ---"). I know I can suppress through Project Properties, Build, Suppress Transact-SQL warnings, but this will globally suppress. Can this be done?

like image 269
Jason Kresowaty Avatar asked May 31 '12 00:05

Jason Kresowaty


3 Answers

You can suppress it at individual file level which contains the code generating the warning if you want. Something like this.

<Build Include="Stored Procedures\X.sql">
    <SuppressTSqlWarnings>71502</SuppressTSqlWarnings>
</Build>
like image 133
Varun Avatar answered Nov 08 '22 09:11

Varun


You weren't clear on what would determine which 71502 messages would be suppressed and which ones wouldn't but based on my own understanding and research I think the answer is the same. In short, no.

You can suppress all warnings, or warnings based on a specific code ( 71502 ) but that is as granular as it gets.

http://msdn.microsoft.com/en-us/library/hh272681(v=VS.103).aspx

This link talks about promoting warning to errors but also demonstrates how the suppress filter is used - which based on your question you probably already know.

http://social.msdn.microsoft.com/Forums/is/ssdt/thread/9b698de1-9f6d-4e51-8c73-93c57355e768

like image 37
RThomas Avatar answered Nov 08 '22 09:11

RThomas


It sounds like you're trying to do this at the object/file level, like a sproc.

If this is the level of granularity you're wanting, then, with the project open, select the object and in the properties is an option to Suppress TSql Warnings, enter 71502 and that should do it.

Other warnings for the object will still be raised - as will 71502 warnings in other objects.

like image 8
Mad-Genius Avatar answered Nov 08 '22 10:11

Mad-Genius