January 4, 2007 at 9:49 am
What is the difference between a Script and a View?
Thanks.
January 4, 2007 at 10:05 am
minor differences: a VIEW is a saved SELECT statement(script), but it has some additional constraints, like all column names in the SELECT must be unique (can't do SELECT ID,ID,* FROM SOMETABLE, gotta use ID AS ID1, ID as ID2, etc) and may not include an ORDER BY unless TOP is used.
a SELECT statement, if run once, will cause SQL Server to create an execution plan so that if it is called again, SQL server will already have a plan to get the data again faster. that plan will expire after a while if it does not get called frequently.
A view's plan is compiled and stays in place.
Lowell
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply