Exists and Expand wildcards

netblazernetblazer Posts: 6
edited October 29, 2008 11:37AM in SQL Refactor Previous Versions
I had a happy (Select * FROM) DBA that wrote me a 4000 line script. I useed SQL Refactor to clean up the script and it worked great... except for this :

I had a few sections like this:

IF EXISTS (SELECT * FROM dbo.Clients)
BEGIN
SELECT 1 AS TEST
END
ELSE
BEGIN
SELECT 0 AS TEST
END

And when hitting the expand wildcard option, all the exists had the full columns listed. Now I know it doesn't change anything eprformance wise but I still see this as useless visual noise. I would be awesome if Refactor could recognize the exists and ignore the wildcard in the next parenthesis.

Comments

  • Thanks for the feedback. I've raised this as a feature request and the developers will look into this when they work on a future version of the software. For your reference the feature request tracking code is: SR-824
  • I have seen references that advise not using Select * in an exist clause. I believe the recommendation is to use "If exists (Select 1 from myTab where ..)" As I recall there is a slight but measurable performance gain.
    Ray Herring
Sign In or Register to comment.