Benchmark IT Consulting Rotating Header Image

sp_refreshview How Did I Forget You?

So a developer asked me a question about how he added a column to a table and now the view that referenced the table wasn’t showing the column.  I asked the obvious question: “Did you add the column to the view?” to which he replied “The view is doing a SELECT *”

OK it may not be that bad… and it definitely not the reason for this post as I think enough people have wrote articles on why you shouldn’t use SELECT * …. so anyways I queried the view myself and saw the same thing that the developer saw.

So after a little “googling” I came across sp_refreshview.

sp_refreshview (Transact-SQL)

“Updates the metadata for the specified non-schema-bound view. Persistent metadata for a view can become outdated because of changes to the underlying objects upon which the view depends.”

So I’m not sure if it’s because I don’t develop alot these days or if it’s because I name all my columns in my views directly but sp_refreshview slipped my mind so I thought I’d write a blog post about it just in case I’m not the only one.

Other ways to resolve this would be to do an ALTER VIEW and just keep the schema the same or to DROP and CREATE the view again (but you risk losing all permissions on the view so that’s just a bad idea).  If Microsoft gives you a “sp_refreshview” just for this reason… I say use it! :)

EDIT: Denis Gobo tweeted me with a great article he wrote as well on the subject at LessThanDot

Enjoy!!

Post to Twitter Post to Delicious Post to Digg Post to StumbleUpon

Congrats to Team Canada!!

It’s a rarity for me to blog about something non-SQL Server related but I have to tell you the 2010 Winter Olympic Games were pretty amazing.  Anyone who knows me (or who met me at the Summit last year) knows that I’m a huge hockey fan and I have to give credit where credit is due… Team USA beat us in the preliminary round and gave us everything we could take in the Gold medal game……..but

Sorry Team USA… no “Miracle on Ice” this time. LOL

Hockey was not the only thing that interested me this Olympics though… it’s amazing how you can get into so many sports that you normally would not watch at all just because the participants are representing your country.  I saw curling, speed skating, moguls, ski jumping, downhill skiing, bobsledding, snowboarding and yes even figure skating LOL. 

I hated Canada’s “Own the Podium” campaign… it felt very “un-Canadian” to me and put a dark cloud (in my opinion) on the unprecedented success that Canada had at this years Winter Olympics.  It is obviously every countries wish to do well at the Olympics and whether the campaign was put in place to help raise money for our Olympic athletes or just raise general awareness for Canadians about the Olympics… if you took a poll of everyday average Canadians I think they would say it was in bad taste and didn’t represent Canada in a very favorable light.

That being said…. Thanks to all who represented our country and a special “shout out” to the Men’s and Women’s Hockey Teams!!!

Post to Twitter Post to Delicious Post to Digg Post to StumbleUpon

Rebooting a Server Using PowerShell

The more I work with PowerShell the more I love it :)

love4

So what do you do if you’re in a VM environment and you want/need to reboot your server but you can’t connect via RDP and you can’t connect to the console using the VM Infrastructure Client, and all other attempts to connect just don’t work.  I decided to go down the route of using PowerShell.

$ServerToRestart = Get-WMIObject win32_operatingsystem -computer <<Your Server Name Here>>
$ServerToRestart.reboot()

Get-WMIObject – Windows PowerShell: The WMI Connection

Simple, easy and very dangerous/powerful.  I’ll channel my inner “Uncle Ben” (see Spiderman quotes) and just leave this message as a closing thought:

“With Great Power Comes Great Responsibility”

Enjoy!!

Post to Twitter Post to Delicious Post to Digg Post to StumbleUpon

EDMPASS Meeting – January 27th 2010 #YEG

On January 27th 2010 the Edmonton Chapter of PASS is having it’s next meeting. Details below:

http://www.eventbrite.com/event/503789849

Please be sure to not only click the “Add to my calendar” but also the “Register” button so that we can plan accordingly for food and drinks. 

Date:  Jan 27th 2010
Time: 5:00 pm – 7:00 pm
Location: Stanley A. Milner library
Map: 7 Sir Winston Churchill Square
Meeting Room: Centennial Room – Basement Level
Speaker: Buck Woody
Topic: Improvements in SQL Server 2008 and SQL Server 2008R2

Session Abstract:

“Come hear Buck Woody, Microsoft’s “Real World DBA”, explain the improvements in SQL Server 2008 and SQL Server 2008R2 over SQL Server 2000 and SQL Server 2005. He’ll show you what the new features are for developers and DBA’s and a quick overview of the new Business Intelligence features. He’ll show some practical examples of the new Transact-SQL statements, management features, and data types so that you can figure out where it fits in your organization.”
Presenter Information:  Buck Woody (http://blogs.msdn.com/buckwoody/)

Buck Woody has been working with Information Technology since 1981. He has worked for the U.S. Air Force, at an IBM reseller as technical support, and for NASA as well as U.S. Space Command as an IT contractor. He has worked in most all IT positions from computer repair technician to system and database administrator, and from network technician to IT Manager and with multiple platforms as a Data Professional. He has been a DBA and Database Developer on Oracle systems running on a VAX to SQL Server and DB2 installations. Buck has a business degree and several industry certifications, including MCSE, MCDBA and Brainbench DBA. He is the author of over 400 SQL Server articles and five published SQL Server books; he is the site personality on InformIT.com’s SQL web, and was the President of the Tampa SQL User’s Group for 5 years. He was awarded the Microsoft MVP Award in 2006 for SQL Server, and started work in the SQL Server Team at Microsoft a year later. He has over twenty years extensive professional and practical experience in computer networks and database design. He also teaches a Database Design course at the University of Washington. 

Agenda:
5:00 pm – Pizza and Socializing
5:30 pm – Sponsor Presentation
5:45 pm – Feature Presentation
7:00 pm – Wrap Up and Draws

If you haven’t signed up already at EDMPASS.com please do so now to receive meeting notifications, news, and updates from EDMPASS.

Hope to see you there.

Enjoy!!

Post to Twitter Post to Delicious Post to Digg Post to StumbleUpon

A Very Busy January

First off I’d like to say Happy New Year to everyone and extend my congratulations again to all the new MVPs out there… well done and the community is a better place because of people like you.

January is going to be a VERY busy month for me both personally and professionally so I thought I would write a quick blog post just so people don’t think I’ve fallen off the face of the earth or something LOL :)   The biggest and challenging task at hand is I need to have the first draft of my final 2 chapters done by February 1st.  While I’m not concerned too much about making this deadline I’m doing my best to make sure I don’t make the same mistakes I made in my first chapter with these final 2 chapters.

119781430229100

The second thing on my “hit list” for January is the EDMPASS meeting on January 27th with Buck Woody.  This will be the first time that I’m going to make the meeting “public” via Live Meeting and also going to work with recording it and making it available after the fact as well.

EDMPASS

A couple personal items are next for me as I’m leaving on a jet plane on January 20th to go to Las Vegas to play in a Ball Hockey tournament called “The Sin City Shootout”.  I didn’t take any time off during the holidays as I was covering for alot of people that did so this will be a nice little break and alot of fun if only for 5 days.  From my previous trips to Vegas 5 days is pretty well the max for me cause (for me anyways) Vegas after 5 days is just annoying.

11lvs

And finally I hope to make a trip somewhere in there for the weekend up to Cold Lake (about 3 hours NE of Edmonton) to see my sister, brother-in-law, niece, and new baby niece Ella.  I’ve seen pictures and videos but I can’t wait to get up there and spend some QT with the new little addition to my sister’s family.

I hope everyone is doing well and sorry for being a bit out of touch (via MSN, Twitter, etc)

Enjoy!!

Post to Twitter Post to Delicious Post to Digg Post to StumbleUpon

Twitter links powered by Tweet This v1.6, a WordPress plugin for Twitter.