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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Bulk insert xml to table

Author  Topic 

bonekrusher
Starting Member

44 Posts

Posted - 2008-11-19 : 12:26:41
Hi,

I am trying to use BULK INSERT to insert some xml into a table using a mapping schema. How can I do this through a T-SQL statement?

assume my mapping file is h:\map.xml

BULK INSERT tbl_table
FROM 'h:\test-cvs2.xml' .....?
GO


Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-19 : 12:34:45
see this

http://msdn.microsoft.com/en-us/library/ms191184(SQL.90).aspx
Go to Top of Page

bonekrusher
Starting Member

44 Posts

Posted - 2008-11-19 : 13:00:15
Thanks. This is a bit confusing to me. I need to create a bcp format file for the table. When I try to run bcp from the command line:
bcp [MYDATABASE].[dbo].[tbl_table] format nul -T -c -x -f format.xml

I get a connection error:
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

SQLState = 08001, NativeError = 2
Error = [Microsoft][SQL Native Client]Named Pipes Provider: Could not open a con
nection to SQL Server [2].
SQLState = HYT00, NativeError = 0
Error = [Microsoft][SQL Native Client]Login timeout expired
SQLState = 08001, NativeError = 2
Error = [Microsoft][SQL Native Client]An error has occurred while establishing a
connection to the server. When connecting to SQL Server 2005, this failure may
be caused by the fact that under the default settings SQL Server does not allow
remote connections.

This cant be that difficult to do...can it?
Go to Top of Page

bonekrusher
Starting Member

44 Posts

Posted - 2008-11-19 : 13:35:55
Nevermind...
Thanks for the help.
Go to Top of Page
   

- Advertisement -