Flat file to SQL Server 2005 table RRS feed

  • Question




    Can someone send me in point form how to upload flat file data to a Sql Server 2005 Database programmatically.

    Code would be great in C#.



    I came across some samples of how to do this but its not clear enough.


    Can some one send me some coding so that i can substitute my variables to them.


    A OLEDB and a Flat file connection would do.




    Thursday, October 16, 2008 5:04 AM

All replies

  • Hi Lucki,

    Why do you want to do this programmatically when you can do this easily using SSIS ?

    Let me know if you have any particular reason/requirement/concern ?

    Thanks & Regards,
    Kapadia Shalin P.
    Thursday, October 16, 2008 5:50 AM
  • I have different sources with different data.So i cant create a single SSIS package for all.

    So Can some one plz give me the steps and the codes to this programmatically





    Thursday, October 16, 2008 6:23 AM
  • moved to the dataset forum.

    Thursday, October 16, 2008 6:29 AM
  • Hi


    Can some one give me some help.




    Thursday, October 16, 2008 6:43 AM
  • The SQL Server people are right (sort of). You should use SSIS or the SqlClient.SqlBulkCopy class. The trick is to expose the flat files as a xxDataReader. This can be done by using the JET/OLE DB .NET data provider. I iwrote an application example to do this in this article. I also discuss the technique in my book.



    Sunday, October 19, 2008 12:38 AM