Using the table structure below how would I create a bcp bulk insert that would handle the XML data. It is important that this is run from command line.
CREATE TABLE [dbo].[MyTable](
[Id] [uniqueidentifier] NOT NULL DEFAULT (newid()),
[MyXmlField] [xml] NULL
Thanks in advance…
The basic syntax for using bcp is:
Where the arguments take the following values:
name of the table. For example, you
might use inventory.dbo.fruits to
insert records into the fruits table,
owned by the database owner, in the
inventory database.
to import (“in” direction) or export
(“out” direction) data.
file. For example, you could import
the file C:\fruit\inventory.txt.
parameters for the bulk operation.
For example, you can specify the
maximum number of errors allowed with
the –m option. You may also use the
–x option to specify an XML file
format. Consult Microsoft’s bcp
documentation for a full list.
Will need more info to know what switches to use, but it should be somehting like
-c Performs the operation using a character data type.
-T Specifies that the bcp utility connects to SQL Server with a trusted connection using integrated security.
Also here is Microsoft’s bcp Utility which should help you with knowing what switches to use.