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.
| Author |
Topic |
|
Ranjit.ileni
Posting Yak Master
183 Posts |
Posted - 2011-03-04 : 01:42:47
|
| Hi,here is the tableDROP TABLE dbo.ATP_MD_CLASSESGOCREATE TABLE dbo.ATP_MD_CLASSES ( CLASS_ID integer NOT NULL IDENTITY(1,1) ,CLASS_SERVICE_TYPE varchar(50) NOT NULL UNIQUE ,CLASS_DESCRIPTION varchar(30) NOT NULL UNIQUE ,CLASS_STATUS bit NOT NULL DEFAULT 'TRUE' )GOnow using only bcp i need to import the data from text file .here is the text file data(for sample)flight1,economy,1flifgt2,businness,0 I imported data from text file to table by using bulkinsert with formatflie(by making some changes in format file) as well as by creating a view (second , third, fouth columns)But, as per my requirement How can i import text file data by using bcpcould u assist me Thanks--Ranjit |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2011-03-04 : 06:01:20
|
| You can use BCP with a format file. Look up "format files" in BOL and read the non-XML format files section |
 |
|
|
Ranjit.ileni
Posting Yak Master
183 Posts |
Posted - 2011-03-04 : 06:44:12
|
| thank you ,I got the expected output by using bcp with format files(making some changes) using following syntax bcp [table_name] in [data_file_name] -f [format_file_name.fmt] -S [server name]-t, -U [username] -P [password]--Ranjit |
 |
|
|
|
|
|
|
|