Solved

SQL comma delmited text

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

758 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

22 Experts available now in Live!

Get 1:1 Help Now