LessThanDot Site Logo

LessThanDot

A Technical Community for IT Professionals

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Highly Rated Users

Forum
No Posts Rated

Top 50
Given
Received

Forum Statistics

Users
Members:
1879
Members Online:
1
Guests Online:
81

Total Post History
Posts:
81451
Topics:
18716

7-Day Post History
New Posts:
0
New Topics:
0
Active Topics:
0

Our newest member
mwojcik

Other

FAQ
All times are UTC [ DST ]

Ignoring commented code

Please wait...

Ignoring commented code

Postby junger on Thu Nov 06, 2014 4:21 pm

Is there a way to modify the [test views with order by] proc so that comments are ignored? In some of my more complicated views I include test queries in the header and these frequently contain order by clauses.

If not, is there a way to flag a view or a proc so that SQL Cop ignores it?

Thanks,
junger
Newbie
Newbie
 
Posts: 2
Joined: Thu Nov 06, 2014 4:18 pm
Unrated

Re: Ignoring commented code

Postby gmmastros on Thu Nov 06, 2014 5:01 pm

SQLCop is written in a way that does not affect the database. Specifically, no objects are created in the database that is being checked. I'm a firm believer that databases should not be polluted any more than necessary.

The problem with ignoring comments is that comments can be complicated. You can nest comments and there are multiple ways to comment code. My fear is that a bug could be introduced that causes SQLCop to miss problems.

That being said, it probably wouldn't be too difficult to get SQLCop to ignore certain objects. This functionality does not currently exist, but could be added without too much effort.

I'm thinking....

If there is a comment in the code of #SQLCopIgnore then the entire object could be ignored. I could also add another check in SQLCop that shows ignored objects.

So much to do, so little time. I'll add it to the list of things to do. Thanks for your suggestion.
-George
User avatar
gmmastros
LTD Admin
LTD Admin
LTD Gold - Rating: 1630LTD Gold - Rating: 1630LTD Gold - Rating: 1630LTD Gold - Rating: 1630LTD Gold - Rating: 1630
LTD Gold - Rating: 1630LTD Gold - Rating: 1630LTD Gold - Rating: 1630LTD Gold - Rating: 1630LTD Gold - Rating: 1630
LTD Gold - Rating: 1630LTD Gold - Rating: 1630
 
Posts: 2369
Joined: Tue Oct 09, 2007 5:19 pm
Unrated

Re: Ignoring commented code

Postby junger on Thu Nov 06, 2014 8:20 pm

I just noticed that my views with Rank() Over(Partition...) are also showing up on the list.

example snippet: ,RANK() OVER ( PARTITION BY c.Id ORDER BY a.aulBalance DESC, a.id DESC ) AS rankID
junger
Newbie
Newbie
 
Posts: 2
Joined: Thu Nov 06, 2014 4:18 pm
Unrated