Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to do bulk import Using C#+sql server 2005

Author  Topic 

imgajin
Starting Member

5 Posts

Posted - 2010-10-24 : 08:00:38

Hi ,
I am using C# + sql server 2005 . data have fixedlegnth .txt file.
table structure

CREATE TABLE [dbo].[TB](
[code] [nvarchar](3) NULL,
[name] [nvarchar](6) NULL,
[ts] [nvarchar](4) NULL,
[city] [nvarchar](6) NULL
) ON [PRIMARY]

sample data like this;
123xxxxxxaaaaxxxxxx

How to bulk inport this data. Please give idea.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-24 : 13:18:39
You can use BULK INSERT command. I believe C# has a native bulk loader though, but BULK INSERT will work for the T-SQL flavor.

If you don't need to use C#, then you can use bcp.exe, SSIS, or the import/export wizard.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

imgajin
Starting Member

5 Posts

Posted - 2010-10-25 : 03:18:53

hi tkizer
thank u for ur suggetion . i need to use C# because this system like batch file.
Go to Top of Page
   

- Advertisement -