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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Open Qry

Author  Topic 

sowmyav
Starting Member

34 Posts

Posted - 2009-03-06 : 03:53:47
Hi,
I created a linked server from sql server2005 to connect to the Oracle DB.
It's working fine.
And I want to fetch the rows from sql server and for creating ,
Select * into tablename(qry)
can be given.Everything is fine.
For one table called T_EVT which has 6878528861 rows.
I would like to create a new table based on the condition after dropping the same table previously.
so For EG:
Drop table tablename;
Create table tablename as (select a.col,b.col,c.col,d.cl
from table1 a,
table2 b,
T_EVT c
where b.name =a.name and
c.AID>'20070101')
So I needto use T_EVT table .
so whether I can use the open query for the drop and create table.
or open query is for only insert,select and delete.

Please let me know the syntax for the create table in the open query statement.

Thanks,
Sowmya

sowmyav
Starting Member

34 Posts

Posted - 2009-03-06 : 04:45:01
Can any one please let me know whether in the OPEN QUERY syntax,we can give the create and drop table command.

It would of very great help.....

Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-03-06 : 05:08:39
Why don't you look into BOL for syntax etc. Anyways,

syntax from BOL,

SELECT *
FROM OPENQUERY(OracleSvr, 'SELECT name, id FROM joe.titles')
Go to Top of Page

sowmyav
Starting Member

34 Posts

Posted - 2009-03-06 : 06:11:46
Thanks for the syntax...
I know the syntax for the select ,insert and delete...
I would like to know wehther the create and Drop command can be given in the open Query???

Thanks,
Sowmya
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-03-06 : 07:43:09
If the user you are using in the linked server has permissions to DROP, CREATE, then yes, it will work. Why not try it and find out?
Go to Top of Page
   

- Advertisement -