SQL OPENQUERY SELECT FROM create table

Fezi
Fezi used Ask the Experts™
on
Hi Experts,

I have a MS SQL database, I am using OPENQUERY to select a query from mySQL database, I want to create a table in the MS SQL database, that I am querying

my OPENQUERY is as follows:

SELECT * FROM OPENQUERY (NSC_LINK,'SELECT * FROM tblsdslist')

the database displays, but how do i import the results in the database (ms sql).

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
one quick way is

SELECT * INTO yournewtable FROM OPENQUERY (NSC_LINK,'SELECT * FROM tblsdslist')

if not, you first create the table

create table yourtable ( col1 datattype, ....)

and then do

insert yourtable
select * from OPENQUERY(.....

(of course you need to make sure your columns match)

Author

Commented:
EXCELLENT. it worked. Thank you. Genius!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial