Solved

SQL comma delmited text

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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.​
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now