September 11, 2008 at 4:03 am
Hi All,
EXEC sp_addlinkedserver TEXT_LS, 'Jet 4.0', 'Microsoft.Jet.OLEDB.4.0', 'C:\files\', NULL, 'Text'
GO
EXEC sp_addlinkedsrvlogin TEXT_LS, false, NULL, NULL, NULL
exec sp_tables_ex TEXT_LS
From the above script is it possible to get the output to the table. for ex:
select * into Test exec sp_tables_ex TEXT_LS
However, I am getting output when I execute "exec sp_tables_ex TEXT_LS" .
Thanks in advance for any input in this.
Regards,
Mohanraj Jayaraman
September 11, 2008 at 4:18 am
Hi,
If I've read that correctly you can insert the results in to a table. You will need to create the table to hold the expected results first but you can then use:
INSERT INTO test
EXEC sp_tables_ex TEXT_LS
HTH,
September 11, 2008 at 4:35 am
Hi
Thanks for you reply its works for me.
At the time of interview they asked me this question but I dont have answer for this (select * into ..... )
Do you know why select * into will not work when Insert into works.
Regards,
Mohanraj Jayaraman
September 11, 2008 at 4:39 am
Without going in to specifics (as I don't know why it happens this way), the data will be returned from the procedure by a SELECT statement. Using SELECT * INTO x EXEC would basically be trying to SELECT * INTO x FROM SELECT ..... which is syntactially bad.
INSERT INTO x EXEC would be INSERT INTO x SELECT... which is the correct way in a single statement.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply