[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

export sql records to csv file

Posted on 2005-05-16
5
Medium Priority
?
561 Views
Last Modified: 2008-02-26
Hello,
I need to export records from a sql table to a csv file. The recorords are not unique by just 1 value.
It actually needs to values in the record to make it unique.
In other words, there may be 5 names that go by Harry so I need to make sure that the last name is
attached to the correct first name.  Any suggestions on how to go about this.  Write a script?  Create  a dts
package?  Ant thoughts would be greatly appreciated.  I am using SQL (8).
Thanks
Mike
0
Comment
Question by:mhedrick
  • 2
  • 2
5 Comments
 
LVL 23

Assisted Solution

by:Saqib Khan
Saqib Khan earned 300 total points
ID: 14011241
Just Run the Query in Query Analyzer, Select All the Records (output) , Right Click and Choose SAVE AS, it will save your File(Selected Records) as CSV.
0
 
LVL 21

Accepted Solution

by:
Kevin3NF earned 300 total points
ID: 14011247
Create a query that correctly selects the information you want, then create a DTS package that uses that same query to export to CSV

i.e.:

Select Distinct FirstName, LastName
From Person


Then use the DTS wizard, and select "use a query...." in teh appropriate screen
0
 

Author Comment

by:mhedrick
ID: 14011326
Thanks for the quick replies,
This process needs to be automated into a project so I cannot do the save as,  I wish I could but.
I want to create a csv file  after a user closes there vb application, then the csv
will be exported into paradox(4.5).  I can hear the chuckling now.....
Kevin, is the export to csv a built in funtion in the DTS package.  Can i just tell it to create a csv file
to a directory on the server.  Any thoughts on performance between dts and script?
Thanks
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 14011401
Then you have to use DTS and Schedule a JOB in SQL Server, That JOB will execute your DTS Package.
0
 
LVL 21

Expert Comment

by:Kevin3NF
ID: 14011441
DTS and script work in conjunction with each other.  Yes, the DTS wizard has Excel as a destination option.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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…
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.
Suggested Courses

872 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