Solved

SQL comma delmited text

Posted on 2011-02-24
4
352 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 500 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

809 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