Updating Views

  • I've had to correct views I've inherited that used select * and returned many unneeded columns. A quick and dirty way to correct them is to right click a view, select Open, select the 'show sql pane' button in the toolbar, and add to the displayed query WHERE 1=0 (or something of the like). I click the exclamation point and the resulting sql query string now explicitly shows all columns. You can now copy this and alter your view in a normal ssms window. It is a time saver when the view returns tens of columns.

    ----------------------------------------------------

  • Nince question,Thank you Steve.

    “When I hear somebody sigh, ‘Life is hard,’ I am always tempted to ask, ‘Compared to what?’” - Sydney Harris

  • Nice question.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Really good one! Didn't know about the SP but got it right through exclusion- of course, the only really correct answer wasn't offered.

    (drop this badly designed view and fire any dev that complains about his app crashing as a result)

Viewing 4 posts - 31 through 33 (of 33 total)

You must be logged in to reply to this topic. Login to reply