How can we help you today? How can we help you today?

Code Analysis VS "IS DISTINCT FROM"

using "IS DISTINCT FROM" in a proc, disables code analysis :-(
Where is the green underline under @unused in proc test2 / line #17?
SSMS 20.2 / SQL Prompt 10.14.21.9884  / Default Code analysis rules

UPDATE: Just realised that this also breaks the intellisense and it is a rather old and known issue,
still not fixed: SQLServer2022 - IS [NOT] DISTINCT FROM breaks intellisense — Redgate forums


henrik_ffc
0

Comments

4 comments

  • Dan_J
    Hi @henrik_ffc

    Thanks for reaching out to us regarding this.

    We have been looking over what you have provided and do think there is something not quite right with Code Analysis here. We're engaging with our development team on this and will come back to you again if we have any questions, or when there is an update.
    Dan_J
    0
  • Dan Jary

    Hi henrik_ffc 

    My apology for the delay in updating you on this.

    Just to make you aware that our development team are continuing to engage with Microsoft on this. Essentially, they do not support the syntax for "IS [NOT] DISTINCT FROM," which is causing a parse error in SQL Prompt.

    I will update you again as soon as a fix has been implemented for this by Microsoft.

    Dan Jary
    1
  • Dan Jary

    Hi henrik_ffc 

    My apology, I have been checking through some forum threads and found you didn't receive an update from us on this! 

    Just to confirm that "IS [NOT] DISTINCT FROM" does now successfully parse.

    Dan Jary
    0
  • Henrik

    Not true!

    This is from today 2026-03-27, SQL Server 2025 CU 3, SSMS 22.4.1, Prompt 11.3.8.22342.

    Code analysis is still wrong, when looking for unused variables

    Henrik
    0

Add comment

Please sign in to leave a comment.