locked
How to insert table data into csv file RRS feed

  • Question

  • The issue that am facing is

      TID      Markettype          Tradetype                  Issuername

      100      primary               purchase                     Wideopenwest Finance,LLC

      101      secondary           purchase                     J,crew

      102      secondary           purchase                     toys"R" Us,Inc.

    Thursday, December 13, 2012 6:02 AM

Answers

  • Use the Dataflow task and flat file destination with csv as file type. Define your delimiter and text qualifier(generally not required for csv).

    Better don't define "," as a separator

    http://www.networksteve.com/enterprise/topic.php?TopicId=33731

    http://ask.sqlservercentral.com/questions/39375/export-to-excel-or-csv-using-ssis.html

    Regards,Eshwar.


    --Please use Marked as Answer if my post solved your problem and use Vote As Helpful if the post was useful.


    • Edited by Eswararao C Thursday, December 13, 2012 7:21 AM
    • Proposed as answer by Eileen Zhao Tuesday, December 18, 2012 8:42 AM
    • Marked as answer by Eileen Zhao Wednesday, December 19, 2012 9:03 AM
    Thursday, December 13, 2012 7:09 AM
  • create table ww
    (
     col1 int,
     col2 varchar(50),
     col3 varchar (50)
    )

    insert into ww values (47,'ReadyShip','(503)888-999')
    insert into ww values (48,'MyShipper','(503)1212-454')
    insert into ww values (49,'ReadyShip','(45)888-999')
    insert into ww values (50,'MyShipper','(545)1212-454')


    exec master..xp_cmdshell 'BCP dbname..ww IN d:\test1.txt -c -C850 -SServerName -Usa -Ppass'


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

    Thursday, December 13, 2012 7:46 AM

All replies

  • plz help its urgent
    Thursday, December 13, 2012 6:06 AM
  • Use the Dataflow task and flat file destination with csv as file type. Define your delimiter and text qualifier(generally not required for csv).

    Better don't define "," as a separator

    http://www.networksteve.com/enterprise/topic.php?TopicId=33731

    http://ask.sqlservercentral.com/questions/39375/export-to-excel-or-csv-using-ssis.html

    Regards,Eshwar.


    --Please use Marked as Answer if my post solved your problem and use Vote As Helpful if the post was useful.


    • Edited by Eswararao C Thursday, December 13, 2012 7:21 AM
    • Proposed as answer by Eileen Zhao Tuesday, December 18, 2012 8:42 AM
    • Marked as answer by Eileen Zhao Wednesday, December 19, 2012 9:03 AM
    Thursday, December 13, 2012 7:09 AM
  • thanks for ur response...
    Thursday, December 13, 2012 7:36 AM
  • create table ww
    (
     col1 int,
     col2 varchar(50),
     col3 varchar (50)
    )

    insert into ww values (47,'ReadyShip','(503)888-999')
    insert into ww values (48,'MyShipper','(503)1212-454')
    insert into ww values (49,'ReadyShip','(45)888-999')
    insert into ww values (50,'MyShipper','(545)1212-454')


    exec master..xp_cmdshell 'BCP dbname..ww IN d:\test1.txt -c -C850 -SServerName -Usa -Ppass'


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

    Thursday, December 13, 2012 7:46 AM