Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL comma delmited text

Posted on 2011-02-24
4
Medium Priority
?
364 Views
Last Modified: 2012-05-11
OK I have been trying to figure this out for some time. I have a query and I need to save the output as a comma delimited text file once a month. this is for 40 2000 and 2005 SQL servers so I would like it to happen automatically using whatever is available. any help would be apreciated

here is what the query will somewhat look like

SELECT
     ddddd_xxxx.id "TURBINE",
     ddddd_xxxx.dttm "DTTM",
     ddddd_xxxx.wind_speed "N WIND SPEED",
     ddddd_xxxx.kw "POWER",
     ddddd_xxxx.nacelle_position "NACELLE POSITION",
     ddddd_xxxx.gen_rpm "GEN SPEED",
     ddddd_ccccc.torque_actual "TORQUE",
     ddddd_ccccc.tower_acceleration "TOWER ACC",
     ddddd_ccccc.drivetrain_acceleration "DT ACC",
     ddddd_xxxx.ambient_temp "AMB TEMP",
     ddddd_xxxx.actual_angle_blade_1 "BLADE1",
          ddddd_xxxx.actual_angle_blade_2 "BLADE2",
          ddddd_xxxx.actual_angle_blade_3 "BLADE3",
     ddddd_xxxx.operating_state "OS",
     ddddd_ccccc.reactive_power_kvar "REACTIVE POWER",
     ddddd_xxxx.volt_phase_a "VOLTAGE A",
     ddddd_xxxx.volt_phase_b "VOLTAGE B",
     ddddd_xxxx.volt_phase_c "VOLTAGE C",
     ddddd_ccccc.nacelle_temp "NAC TEMP",
     ddddd_xxxx.cos_phi "PF",
     ddddd_ccccc.shaft_bearing_temp "MAIN BEARING TEMP",
     ddddd_xxxx.tran_bearing_a_temp "GBX BEARING A TEMP",
     ddddd_xxxx.tran_bearing_b_temp "GBX BEARING B TEMP",
     ddddd_xxxx.tran_temp "GBX OIL TEMP",
        /*ddddd_xxxx.tran_oil_prss "GBX OIL PRESSURE",*/
     ddddd_xxxx.bearing_a_temp "GEN BEARING A TEMP",
     ddddd_xxxx.bearing_b_temp "GEN BEARING B TEMP",
      ddddd_xxxx.wind_deviation "WIND DEVIATION"
FROM
     ddddd_xxxx, ddddd_ccccc
WHERE
     ddddd_xxxx.site_id = ddddd_ccccc.site_id  
 AND ddddd_xxxx.dttm =ddddd_ccccc.dttm
 AND ddddd_xxxx.id =ddddd_ccccc.id
 AND ddddd_xxxx.id > 850033400  
 AND ddddd_xxxx.id < 850033500
 --AND ddddd_xxxx.site_id = 183
 AND ddddd_xxxx.dttm >= '01-SEP-10'
 AND ddddd_xxxx.dttm < '01-OCT-10'
ORDER BY 1,2
;
0
Comment
Question by:arahming
  • 2
4 Comments
 
LVL 5

Expert Comment

by:jijeesh
ID: 34971615
0
 
LVL 15

Accepted Solution

by:
Aaron Shilo earned 2000 total points
ID: 34972387
hi

use the import/export wizard from ssms to export the specific table to a flat files with dilimeted and save it and make a job to run it once a month.
0
 
LVL 1

Author Comment

by:arahming
ID: 34974365
bcp doesn't work and I can not find where the import/export will be helpful I need to query certain data from two tables
0
 
LVL 1

Author Closing Comment

by:arahming
ID: 34975396
simplicity is best thanks sometimes I forget about the KISS method
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question