Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

how can i restrict the query on query window that contain *(astric) Expand / Collapse
Author
Message
Posted Wednesday, April 23, 2014 8:28 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 5, 2014 9:43 AM
Points: 7, Visits: 36
how can i restrict the query on query window that contain *(astric)


EXP:-
select * from emp
want to stop this king of query,only for the selected column should be allow.
Post #1564309
Posted Wednesday, April 23, 2014 8:39 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:54 PM
Points: 13,471, Visits: 12,329
kumar4ashwani (4/23/2014)
how can i restrict the query on query window that contain *(astric)


EXP:-
select * from emp
want to stop this king of query,only for the selected column should be allow.


Short answer...you can't.

You could jump through a lot of hoops and setup database triggers and all sorts of crazy stuff to try to prevent it but it is only going to slow down the whole system.

Honestly there is nothing wrong select * when used appropriately (like inside an exists). It is however terrible when used to shortcut building the list of columns which is what you are trying to prevent.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1564314
Posted Wednesday, April 23, 2014 9:31 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, September 12, 2014 8:30 AM
Points: 1,542, Visits: 8,255
There was an article on this quite some time back: http://www.sqlservercentral.com/articles/SELECT+*/68324/.

BrainDonor
Linkedin
Blog Site
Post #1564341
Posted Wednesday, April 23, 2014 9:37 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:54 PM
Points: 13,471, Visits: 12,329
BrainDonor (4/23/2014)
There was an article on this quite some time back: http://www.sqlservercentral.com/articles/SELECT+*/68324/.


Just shoot me if I ever work in a place that uses that implementation!!! Even the author agrees it is pretty horrible to work with.

It is a novel approach however.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1564343
Posted Wednesday, April 23, 2014 10:24 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 7:19 PM
Points: 3,660, Visits: 7,985
I can understand the need to prevent the use in production code, but not in ad-hoc queries when developing and testing (I often use it to evaluate a table structure).
You could have a code review policy and prevent changes to stored procedures, functions and views that won't comply with company standards. You could use tools such as Microsoft SQL Server Data Tools, SQLCop, SQL Code Guard or SQL Enlight to review the code (I couldn't find the right product from Red Gate, would it be Code Guard?).



Luis C.
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1564373
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse