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 |
mrjack
Yak Posting Veteran
50 Posts |
Posted - 2006-07-04 : 10:42:12
|
Hi all, im new with this SQL server and found out this new feature.I generated DAT file in my laptop, and i wanted to load it into a table in my server. hw do i proceed with it? i googled, confuse between bulk insert and openrowset...can neone enlighten me? :D thanksJack |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-04 : 11:44:11
|
If you bcp'd the data out then you should bulk insert (or bcp) the data in.You should be able to use the same bcp command just change the out to in and the table/server names.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
mrjack
Yak Posting Veteran
50 Posts |
Posted - 2006-07-04 : 11:55:17
|
well...i use somekind of software to generate the BCP file..so when i want to import it in..it doesnt have the feature..heheheh..i assumed i need to do it myself..so im looking for command to get it in..and its quite big...the DAT file is 1Gb size.. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-04 : 12:36:39
|
You need to know the format of the file to bcp it in.On the server trycreate table #a(s varchar(8000))bulk insert #a from 'c:\myfile.dat' with (fieldterminator = '^', lastrow=10)select * from #aIf it gives an error it probably means that the rows aren't crlf terminated.In which case you will have to find the terminator.maybedeclare @sql varchar(8000)select @sql = 'bulk insert #a from ''c:\myfile.dat''with (fieldterminator = ''^'', rowterminator=''' + char(10) + ''' lastrow=10)'exec (@sql)If that doesn't work try using dts to look at it otherwise your favourite hex editor.Are you sure it's not a propriatory format which you can't import?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|