Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Bulk Insert file into varbinary data

$
0
0

Have a file of EBCDIC data that I want to load into a SQL table. Each  logical record is 247 in length.  i want to read 247 bytes from the file and load as a row into my generic varbinary(4000) column. I cannot get the syntax correct for the format file.

CREATE TABLE File1_bankway
(
Field1 varbinary(4000)
)

BULK INSERT bank85.dbo.File1_bankway FROM 'C:\temp\aaacctt.txt'
WITH (FORMATFILE = 'C:\Temp\Format.xml')

FORMAT FILE


<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
  <FIELD ID="1" xsi:type="varbinary" LENGTH="4000"/>
</RECORD>
<ROW>
  <COLUMN SOURCE="1" NAME="Field1" xsi:type="varbinary" LENGTH="4000"/>
</ROW>
</BCPFORMAT>


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>