| Author |
Topic |
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2004-08-27 : 02:10:53
|
| Hi All,We always say, we should not use select * from table.I want to search all stored procedures in database where "select *" is used. How can i do it.Thanksmk_garg |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-08-27 : 02:34:19
|
| SELECT * from syscomments wheretext like '%select * from%'Should do the trick.... |
 |
|
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2004-08-27 : 02:40:50
|
| Nope!It is giving me store procedure which is not using "select * from"Thanksmk_garg |
 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-08-27 : 02:48:20
|
| hmm - strange that.I've had some problems getting SP text from syscomments.You might be able to do this using VB and SQLDMO objects |
 |
|
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2004-08-27 : 02:55:32
|
| How using VB?I never used SQLDMO. How i can use it?Thanksmk_garg |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-08-27 : 05:07:03
|
| If you download the microsoft best practice analyzer it will identify this for you (amongst other things.)-------Moo. :) |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-08-27 : 07:30:02
|
quote: Nope!It is giving me store procedure which is not using "select * from"
Strange, I have never had this issue !?However you could also do the following:1. Script all the procs to a file2. Open file in texteditor3. Search the text for "select *"/rockmoose |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-27 : 13:03:54
|
| http://vyaskn.tripod.com/code/search_stored_procedure_code.txtTara |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-27 : 13:04:53
|
| And don't forget that SELECT * should be used in EXISTS or NOT EXISTS. But that's the only exception.Tara |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|