Export data to a file

  • I have a table. It has only one column and more that 100,000 rows. Data type is VARCHAR(50).

    I need to to write a sql script that will export this tabel's data to a file.

    Can anyone help !!!

  • what version of Excel do you use? If you use anything less then 2007 then you can not export that many rows. also what version of SQL do you have. if you have 2005 or greater then ssis is the easiest way to do this.

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • This will export data to a CSV file .....

    From DB table to text file. the text file must exist. Text file must have a first line of comma separated field names and select must be by column name. (I have used Notepad to create the text file with just one line, which of course is the name of the field being exported, in this example it is Keyword).

    INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0','Text;

    Database=C:\','SELECT * FROM Test.txt')

    SELECT Keyword FROM dbo.Keywords

    Sample CSV file entries

    Keyword

    "Discs"

    "freespace"

    "drives"

    "UTC"

    "Time"

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply