|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 5:11 AM
Points: 1,168,
Visits: 1,470
|
|
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: Today @ 7:43 AM
Points: 1,372,
Visits: 894
|
|
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 @ 6:13 AM
Points: 2,598,
Visits: 1,551
|
|
| Thanks for the easy one Steve! I think I have used this command maybe once before.
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 5:03 PM
Points: 18,853,
Visits: 12,438
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 11:39 PM
Points: 3,250,
Visits: 65,530
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 10:11 PM
Points: 1,058,
Visits: 1,395
|
|
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: Today @ 6:14 AM
Points: 377,
Visits: 894
|
|
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: Today @ 5:32 PM
Points: 3,508,
Visits: 2,588
|
|
| A nice one to start the week. Thanks, Steve!
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 10:46 PM
Points: 1,114,
Visits: 983
|
|
| Thanks Steve for the easy one !!!!
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 5,293,
Visits: 7,229
|
|
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
|
|
|
|