How to store data from an openquery in a .CSV OR EXCEL FILE?
select * from openquery(DB_LINK,'SELECT col1,col2,col3,col4 from oracle_table_name')
select * from openquery(DB_LINK,'SELECT col1,col2,col3,col4,col5 from oracle_table_name2')
The result has to be stored in 2 different files.
I have scheduled the open query such that it runs on 1st of every month. And the 2 files that are generated have to be kept in client's windows specific folder.
This is the first time I'm using SQL SERVER. So please explain step by step.
I am using this query at the moment.
declare @title varchar(55)
set @title = 'Test'
EXEC sp_makewebtask
@outputfile = 'D:\Test11.xls',
@query = 'select CIRCUIT_DESIGN_ID as [Account Number] from openquery(MSP_PROD,'select CIRCUIT_DESIGN_ID from circuit')',
@FixedFont=0,@resultstitle=@title