var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Create table and insert data based on the return of another query
Not sure if this is possible, but I want to run a query on a linked Oracle database.
Get the result.
Build a new table (tmp or not), create the columns as per the fields returned by the query and insert the data.
Is this possible?
I've done some google searching and couldn't find anything, well tbh not sure what to search on.
*** Edit: the reason I'm asking is that I'm lazy.. ***
I've been tasked with two projects.
1) - Importing the vmquery output from Netbackup.. About 50 columns of data and didn't fancy doing it all manually.
2) - Importing the output of another query which again hasn't been formalised, but will be a lot of fields across several tables.
*** Confession over ***
Last edited by MrRalphMan; 10-03-08 at
IF object_id('dbo.temp_table99') IS NOT NULL BEGIN
DROP TABLE dbo.temp_table99
SELECT comma, separated, list, of, columns, not, the, dreaded, select, star
Cheers, that works for one of em...... Can a permi table be built from the temp one?
Also can the same thing be done via bulk insert, or do you need the format file?
The above isn't a temporary table.
Temporary tables are can be identified by their # (or ##) prefix.
If the table exists then all you have to do is change the INSERT syntax.
INSERT INTO dbo.my_table99 (col1, col2)
Ah ha... didn't spot that, cheers again.