Home All Groups Group Topic Archive Search About

Disable dependence checks when creating view

Author
8 Sep 2005 8:25 AM
Amid
Is it possible to disable checks for existance of referenced tables(views,
user functions) when creating new view

Thanks in advance.

Author
8 Sep 2005 8:33 AM
Tibor Karaszi
Only way would be through CREATE SCHEMA:

CREATE SCHEMA AUTHORIZATION ross
create view v as select * from t
create table t(c1 int)

More information in Books Online.

Show quote
"Amid" <A***@discussions.microsoft.com> wrote in message
news:DEFF0F05-66DD-4ABF-A483-9D934E8A529C@microsoft.com...
> Is it possible to disable checks for existance of referenced tables(views,
> user functions) when creating new view
>
> Thanks in advance.
Author
8 Sep 2005 9:19 AM
Amid
Thanks for the quick reply.

What if i'm unable to create table [t] within the same statement  where [v]
is created?

I need to create it much later.

Any help will be appreciated.

Show quote
"Tibor Karaszi" wrote:

> Only way would be through CREATE SCHEMA:
>
> CREATE SCHEMA AUTHORIZATION ross
> create view v as select * from t
> create table t(c1 int)
>
> More information in Books Online.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
>
> "Amid" <A***@discussions.microsoft.com> wrote in message
> news:DEFF0F05-66DD-4ABF-A483-9D934E8A529C@microsoft.com...
> > Is it possible to disable checks for existance of referenced tables(views,
> > user functions) when creating new view
> >
> > Thanks in advance.
>
>
Author
8 Sep 2005 9:34 AM
Tibor Karaszi
You can't do that. When a view is created, SQL Server need to populate the system tables
(syscolumns) with the columns that the view has (the SELECT in the view definition). SQL Server
cannot do that if the table(s) that the view uses doesn't exist.

Why do you have this need? Sounds like a strange requirement to me...

Show quote
"Amid" <A***@discussions.microsoft.com> wrote in message
news:2C520E2E-FE0C-41D7-95C8-DA19CB87A78F@microsoft.com...
> Thanks for the quick reply.
>
> What if i'm unable to create table [t] within the same statement  where [v]
> is created?
>
> I need to create it much later.
>
> Any help will be appreciated.
>
> "Tibor Karaszi" wrote:
>
>> Only way would be through CREATE SCHEMA:
>>
>> CREATE SCHEMA AUTHORIZATION ross
>> create view v as select * from t
>> create table t(c1 int)
>>
>> More information in Books Online.
>>
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>>
>> "Amid" <A***@discussions.microsoft.com> wrote in message
>> news:DEFF0F05-66DD-4ABF-A483-9D934E8A529C@microsoft.com...
>> > Is it possible to disable checks for existance of referenced tables(views,
>> > user functions) when creating new view
>> >
>> > Thanks in advance.
>>
>>
Author
8 Sep 2005 11:10 AM
Amid
I need to make copy of the database structure (tables, views, sp, uddt, uf,
constraints etc) with several modifications. Unfortunately original database
may me inconsistent (views, user functions in it may refer to the others
database tables or views). Now I cant gain access to that tables but
structure has to be copied. Thus I need to create views and user function
(sp) without actually having needed tables or views.

Thanks.

Show quote
"Tibor Karaszi" wrote:

> You can't do that. When a view is created, SQL Server need to populate the system tables
> (syscolumns) with the columns that the view has (the SELECT in the view definition). SQL Server
> cannot do that if the table(s) that the view uses doesn't exist.
>
> Why do you have this need? Sounds like a strange requirement to me...
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
>
> "Amid" <A***@discussions.microsoft.com> wrote in message
> news:2C520E2E-FE0C-41D7-95C8-DA19CB87A78F@microsoft.com...
> > Thanks for the quick reply.
> >
> > What if i'm unable to create table [t] within the same statement  where [v]
> > is created?
> >
> > I need to create it much later.
> >
> > Any help will be appreciated.
> >
> > "Tibor Karaszi" wrote:
> >
> >> Only way would be through CREATE SCHEMA:
> >>
> >> CREATE SCHEMA AUTHORIZATION ross
> >> create view v as select * from t
> >> create table t(c1 int)
> >>
> >> More information in Books Online.
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >> Blog: http://solidqualitylearning.com/blogs/tibor/
> >>
> >>
> >> "Amid" <A***@discussions.microsoft.com> wrote in message
> >> news:DEFF0F05-66DD-4ABF-A483-9D934E8A529C@microsoft.com...
> >> > Is it possible to disable checks for existance of referenced tables(views,
> >> > user functions) when creating new view
> >> >
> >> > Thanks in advance.
> >>
> >>
>
>

AddThis Social Bookmark Button