|
Posted by Erland Sommarskog on 01/04/07 22:48
Alex Kuznetsov (AK_TIREDOFSPAM@hotmail.COM) writes:
> --CELKO-- wrote:
>> SQL Server is weird on this, but each VIEW statement has to be in a
>> batch by itself. The reason is that VIEWs can be built on VIEWs, so
>> you need to commit the first VIEW to do this.
>>
>
> Incorrect. MS SQL Server does not commit DDL right away (Oracle does).
Joe may have a point, even if did not hit the nail perfectly. Up to
SQL 6.5, there wasn't any deferred name resolution, so something like:
CREATE VIEW innerview AS SELECT 12 AS gurka
CREATE VIEW outerview AS SELECT gurka FROM innerview
would fail at compilation. For tables there were some special plumbing
to permit you to create a table and refer to it in the same batch, but
I guess they never found that worthwhile for views.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|