• davidandrews13 (3/27/2012)


    surely it doesn't matter if you do SELECT *?

    It definitely matters. In the case of this question, you get an error either way. But in an earliers message, I posted a script where, after making some changes in the table, the view produces unexpected (no, a better way to word that is "incorrect") results, without giving an error or even warning message. Replace the * with a column-list in that code, and you'll get an error message. Now, getting an error unexpectedly after changing a table might suck - but not nearly as much as the damage that ccan be caused by a view returning incorrect results without you being alerted to it!

    every time i create or update a view to '*' instead of naming each individual column name, it expands it out to the individual column names anyway.

    That's not standard behaviour. Do you have Red Gate's SQLPrompt installed? Or another, similar product?


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/