Does anyone know a good way to create a table from an existing view...maybe
some jiggery pokery with sp_columns or something. Im tring to create a set
of tables from a set of views, and do the whole thing in batch so im hoping
to carry out the table creation dynamically
Thanks
GerardGenerally views are created from base tables. If you want to create a base
table from a view for some strange reason, perhaps you can use SELECT...
INTO.
However such tables, while can be handy in temporary data processing, in
general may be lacking many data integrity constraints.
Anith|||IF i use SELECT..INTO that will give me a temporary table, but is there
anyway to basically make a view into a physical table? i.e. in Oracle
"CREATE TABLE T AS SELECT * FROM AVIEW"
Thanks
Gerard
"Anith Sen" wrote:
> Generally views are created from base tables. If you want to create a base
> table from a view for some strange reason, perhaps you can use SELECT...
> INTO.
> However such tables, while can be handy in temporary data processing, in
> general may be lacking many data integrity constraints.
> --
> Anith
>
>|||Gerard, The SELECT...INTO will not give you a temporary table, it will give
you a physical table. I think what Anith was saying was that it might be
convenient to do this but not a best practice.
"Gerard" wrote:
> IF i use SELECT..INTO that will give me a temporary table, but is there
> anyway to basically make a view into a physical table? i.e. in Oracle
> "CREATE TABLE T AS SELECT * FROM AVIEW"
> Thanks
> Gerard
> "Anith Sen" wrote:
>|||Ah right, well it does what i want and thats all that matters, i know its no
t
best practice, but i just need a set of tables for reporting to be create
from a set of views. Cheers for your help guys
Gerard
"ZNICHTER" wrote:
> Gerard, The SELECT...INTO will not give you a temporary table, it will giv
e
> you a physical table. I think what Anith was saying was that it might be
> convenient to do this but not a best practice.
> "Gerard" wrote:
>|||Ah right well as long as it creates a physical table im happy, its just for
an ETL mechanism so it doesnt have to be too flashy. Cheers for your help
guys
Gerard
"ZNICHTER" wrote:
> Gerard, The SELECT...INTO will not give you a temporary table, it will giv
e
> you a physical table. I think what Anith was saying was that it might be
> convenient to do this but not a best practice.
> "Gerard" wrote:
>|||Znichter
Temporary tables ARE physical tables. They are just stored in the tempdb
database, and are not permanent.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"ZNICHTER" <ZNICHTER@.discussions.microsoft.com> wrote in message
news:04CFDAA9-93AF-44B6-BC57-5730BD1C0D98@.microsoft.com...
> Gerard, The SELECT...INTO will not give you a temporary table, it will
> give
> you a physical table. I think what Anith was saying was that it might be
> convenient to do this but not a best practice.
> "Gerard" wrote:
>
>|||> IF i use SELECT..INTO that will give me a temporary table,
Why do you say that? SELECT INTO doesn't behave any differently from CREATE
TABLE regarding the type
of table created:
SELECT ...
INTO #myTable
SELECT ...
INTO myTable
First example above creates a temp table, and second creates a regular norma
l table.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Gerard" <Gerard@.discussions.microsoft.com> wrote in message
news:2B7EECE8-67D3-496F-BBBF-7FEE15F86029@.microsoft.com...
> IF i use SELECT..INTO that will give me a temporary table, but is there
> anyway to basically make a view into a physical table? i.e. in Oracle
> "CREATE TABLE T AS SELECT * FROM AVIEW"
> Thanks
> Gerard
> "Anith Sen" wrote:
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment