|
Posted by Alex Kuznetsov on 01/05/07 14:47
Erland Sommarskog wrote:
> 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
Yeah, right, his post makes more sence if one replaces 'commit' with
'submit'.
-----------------------
Alex Kuznetsov
http://sqlserver-tips.blogspot.com/
http://sqlserver-puzzles.blogspot.com/
[Back to original message]
|