|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 4:58 AM
Points: 1,152,
Visits: 1,457
|
|
Bob Razumich (7/2/2012) For a moment, I thought the correct answer was a trick answer. "sp_refreshview"? It just seemed too cute for a Monday, but I looked it up first, anyway. Plus, I'd be strung up if I created a view as Select * from anything. Glad I researched it.
But I have to say that the command would seem to enable poor coding practice in creating a view, IMHO.
It's like Bob was reading my mind! (Except for the fact that he wrote this BEFORE I saw the question. How DO you do that Bob?)
So, +1, and thanks for a great question for a Monday Steve.
Please don't go. The drones need you. They look up to you.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 7:11 AM
Points: 1,356,
Visits: 874
|
|
Great easy question this morning Steve. Thanks for that pick me up on Monday.
Oh no, we're toast! I've got this. *Keyboard clatter* Woah, how'd you do that? I'm a DBA...Booyah
Yeah, uh huh, you know what it is. Everything I do, I do it big

|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 10:59 AM
Points: 2,579,
Visits: 1,537
|
|
| Thanks for the easy one Steve! I think I have used this command maybe once before.
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Yesterday @ 10:25 AM
Points: 18,754,
Visits: 12,337
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 4:24 PM
Points: 3,231,
Visits: 64,372
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 9:31 AM
Points: 1,041,
Visits: 1,356
|
|
Bob Razumich (7/2/2012) For a moment, I thought the correct answer was a trick answer. "sp_refreshview"? It just seemed too cute for a Monday, but I looked it up first, anyway...
+1
I figured the first answer was wrong because DROP...CREATE VIEW is not the only way to fix that problem, even without the existence of sp_refreshview. You can also use an ALTER VIEW statement. Since the third answer was patently untrue as well, whatever remained, however improbable, had to be true.
That's how I deduced that there was, indeed, a stored procedure called sp_refreshview.
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 6:20 AM
Points: 376,
Visits: 885
|
|
sknox (7/2/2012)
Bob Razumich (7/2/2012) For a moment, I thought the correct answer was a trick answer. "sp_refreshview"? It just seemed too cute for a Monday, but I looked it up first, anyway...+1 I figured the first answer was wrong because DROP...CREATE VIEW is not the only way to fix that problem, even without the existence of sp_refreshview. You can also use an ALTER VIEW statement. Since the third answer was patently untrue as well, whatever remained, however improbable, had to be true. That's how I deduced that there was, indeed, a stored procedure called sp_refreshview.
Awesome deduction! Much more entertaining than the method I used.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 2:20 PM
Points: 3,462,
Visits: 2,539
|
|
| A nice one to start the week. Thanks, Steve!
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 1:58 AM
Points: 1,112,
Visits: 970
|
|
| Thanks Steve for the easy one !!!!
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 3:49 PM
Points: 5,244,
Visits: 7,063
|
|
It's a bit disappointing that nobody has yet commented that the "best" way to deal with the issue is to drop the view, then create a new one that does not use SELECT * but spells out the relevant columns. 
Nice question, Steve. Thanks!
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|