Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
5fifty5
Starting Member
35 Posts |
Posted - 2008-11-05 : 09:21:06
|
Hi,I want to create a table which should be based on a view. I have tried the querycreate table test as (select * from test2)but I think I've got it wrong. I thought you coul simply do it like you would do to create a view from table [ create view test as (select a, b from test2) ].I am not quite sure how to do it so any help would be appreciated. |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2008-11-05 : 09:44:29
|
select * into <NewTableName> from <ViewName>This should work for you |
 |
|
5fifty5
Starting Member
35 Posts |
Posted - 2008-11-05 : 10:28:54
|
It looks logical but doesnt work in my scenario. I am doing a select instead of simply putting in the name of the view and not only that, the view is in a different server and database which makes my query looks like:select * into Northwind.dbo.test1 from SERVER2.Northwind.dbo.test2 |
 |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2008-11-05 : 10:50:21
|
Is your server2 a linked server |
 |
|
5fifty5
Starting Member
35 Posts |
Posted - 2008-11-06 : 03:40:37
|
No its not a linked server. both servers, where I am running the query and also where the view is, are independent servers. |
 |
|
5fifty5
Starting Member
35 Posts |
Posted - 2008-11-07 : 05:33:25
|
Help anybody? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-07 : 05:54:50
|
first add the remote server as a linked server to your server and then use above query |
 |
|
|
|
|