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
 General SQL Server Forums
 New to SQL Server Programming
 how to read a file in a directory using T-Sql

Author  Topic 

smeira
Starting Member

6 Posts

Posted - 2008-03-03 : 20:22:48
Hi,
I need to read a XML file inside my procedure and put its contents in a variable.
How do I do it?
Is there a dbo procedure to do it?

Cheers,

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-03 : 20:40:43
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_oa-oz_5c89.asp

maybe a good place to start




Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-03-03 : 20:50:48
DECLARE @xml XML;

-- Use OPENROWSET to read an XML file from the file system
SELECT @xml = BulkColumn
FROM OPENROWSET(BULK 'c:\state-list.xml', SINGLE_BLOB) TempXML

-- View the result
SELECT @xml;

ripped off from http://blogs.sqlservercentral.com/prosqlxml/archive/2008/02/04/loading-xml-from-the-file-system.aspx


elsasoft.org
Go to Top of Page
   

- Advertisement -