|
Posted by Andrea Montanari on 05/11/06 12:44
hi,
groupy wrote:
> Hello all,
> my question might be trivial but since my background isn't DB i'll
> dare to ask it any way:
>
> how to create a real (not virtual) table from view1 & view2 ni sql
> server?
>
> what should i do specificly in the sql server application & what is
> the syntax for that?
>
> i thank all of you,
> groupy.
what you are asking is potentially dangerorus...
you can achieve the desired result UNIONing the desired views specifying the
INTO clause of the SELECT statement, thus effectively creating a new base
table with the output of the SELECT statement... constraints and indexes
associated with the base objects will not be generated, but as you are in
this case dealing with views, chances are that non keys nor indexes are
present...
the dangerous part is about persistency of the new table... it will not be
updated as the base tables of the referencing views will be...
thus what you are getting is a static snapshot f the point in time you
"created" your new table...
and, except perhaps for reporting tasks, I actually do not see a reason to
perform this operation as you are actually doubbling storage requirements,
you are breaking normalization and so on... again, I can see only a static
reporting requirement, say you need to have a point in time "view" of your
sales, and you need it all a month long, then you can do it, regenerating
this dump (but real) table at each month beginning...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sa-ses_9sfo.asp
http://msdn2.microsoft.com/en-us/library/ms190750.aspx
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.18.0 - DbaMgr ver 0.62.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply
Navigation:
[Reply to this message]
|