Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL comma delmited text

Posted on 2011-02-24
4
Medium Priority
?
361 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

Question has a verified solution.

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

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…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

688 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