"Find Unused Variables" misses TABLE variables

danbocdanboc Posts: 23
edited August 4, 2008 8:49AM in SQL Refactor Previous Versions
Hi,

I use the "Find Unused Variables and Parameters" often during scripting. I found that this option doesn't handle TABLE variable at all. Even though the @tableVar is being used in the script (insert, delete, update, select) SQL Refactor will point it out as an unused var.

This has not been fixed in 1.1.3...

Thanks,

Daniel

Comments

  • Eddie DEddie D Posts: 1,800 Rose Gold 5
    Thank you for your post into the forum.

    Can you please confirm the exact version you of SQL Refactor you are refering too?

    SQL Refactor 1.3 released earlier this week on the 28th July 2008?

    Or SQL Refactor 1.1.*?

    Can you please reply with a script that you have created that creates this error.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Hi Eddie,

    Here's the example code that causes the problem. I've narrowed it down to the delete line. If you comment out the delete line then it does NOT point the @table out, if you leave the delete line in then it points it out as an unused variable.

    DECLARE @table TABLE (tabCol1 INT, tabCol2 VARCHAR(50))
    DELETE FROM @table
    INSERT INTO @table (tabCol1,tabCol2)
    SELECT 1,'abc'

    Hope this helps!

    Daniel
  • The version, by the way, is the latest 1.3 release.

    Daniel
  • Eddie DEddie D Posts: 1,800 Rose Gold 5
    Thank you for your reply.

    I was able to recreate the reported problem, thank you for bringing this issue to our attention.

    I have submitted a bug report to highlight the problem for our development team to investigate.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.