Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

help with script

 
   Database Help (Home) -> XML RSS
Next:  Active node and RDP  
Author Message
jojo123

External


Since: Jul 04, 2008
Posts: 16



(Msg. 1) Posted: Fri Aug 01, 2008 2:56 am
Post subject: help with script
Archived from groups: microsoft>public>sqlserver>xml (more info?)

Hi

I have the script below to read xml file into the database which works fine.
I want to be able to read an xml file with any date and file id stamp without
having to change the script each time. The xml filename format is as below

e.g. EAF1NLyymmddffff.xml

Function Main()
Set objBulkLoad =
CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")
objBulkLoad.ConnectionString = "provider=SQLOLEDB;data
source=localhost;database=myproj; integrated security=SSPI"
objBulkLoad.ErrorLogFile = "c:\error.log"
objBulkLoad.Execute "c:\EAF1NL.xsd", "c:\EAF1NL0808010001.xml"
Set objBulkLoad = Nothing
Main = DTSTaskExecResult_Success
End Function

Thanks

 >> Stay informed about: help with script 
Back to top
Login to vote
Jacob Sebastian

External


Since: Aug 18, 2008
Posts: 21



(Msg. 2) Posted: Mon Aug 18, 2008 8:46 am
Post subject: Re: help with script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You could pass the filename as a parameter to the script function.
you could even have a parent method which enumerates the files in a given
folder and call the script to process that file.

is that what you are looking for?

--
Jacob Sebastian
SQL Server MVP
http://www.sqlserverandxml.com

"jojo123" wrote in message

> Hi
>
> I have the script below to read xml file into the database which works
> fine.
> I want to be able to read an xml file with any date and file id stamp
> without
> having to change the script each time. The xml filename format is as below
>
> e.g. EAF1NLyymmddffff.xml
>
> Function Main()
> Set objBulkLoad =
> CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")
> objBulkLoad.ConnectionString = "provider=SQLOLEDB;data
> source=localhost;database=myproj; integrated security=SSPI"
> objBulkLoad.ErrorLogFile = "c:\error.log"
> objBulkLoad.Execute "c:\EAF1NL.xsd", "c:\EAF1NL0808010001.xml"
> Set objBulkLoad = Nothing
> Main = DTSTaskExecResult_Success
> End Function
>
> Thanks

 >> Stay informed about: help with script 
Back to top
Login to vote
jojo123

External


Since: Jul 04, 2008
Posts: 16



(Msg. 3) Posted: Mon Nov 10, 2008 4:13 am
Post subject: Re: help with script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi

I've attempted to do the follwing and get error highlighted below:

..
..
..
Set objFSOFolder = objfso.getfolder(strInboxDir)
for each objFSOFile in objfsofolder.files
if (left(objFSOFile.name, 6) ="EAF1NL" & right(objFSOFile.name,3) =
"xml" then
strFileNameBase = trim(left(objFSOFile.Name, len(objFSOFile.name)-4))
master.WriteLine objFSOFile.name & " in folder @ " & now
end if
next


Set objBulkLoad = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload")
objBulkLoad.ConnectionString = "provider=SQLOLEDB;data
source=localhost;initial catalog=myDB; integrated security=SSPI"
objBulkLoad.Execute "\EAF1NL.xsd", objFSOFile.name '****Error here
Set objBulkLoad = Nothing
Main = DTSTaskExecResult_Success

Set fso = CreateObject("Scripting.FileSystemObject")
..
..
..
 >> Stay informed about: help with script 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
xml to SQL DB - We have some large existing Xml files that we'd like to store in the SQL server. We don't want to store just the Xml stream, but we rather like to build the hierarchical structure that represents the Xml in SQL and store the Xml that way. We also want...

how to store a word document in sql server - I Need help on how to store a word document in sql server.what datatype and how to convert it to store it. Pleas Help Thank you

SQLXML Prerequisites - I see that SQLXML 3.0 SP3 no longer depends on SOAP Toolkit 2.0 SP2. I have seen postings from earlier last year, i.e. Feb '04 (give or take a few months), that the prerequisite for SQL Server Client Tools would be removed. I don't see any mention o...

specify criteria dynamically with OpenXML - Hi Folks I need to put the following OPENXML into a while loop (to process each row individually), but don't seem to be able to apply a filter using variables. Don't seem to be able to find the docs/syntax to use variables here: [@StepName=''Process....

Q: mapping a single XML file into multiples SQL tables - Hello, I'm new to SQLXML features, and I'd wish to import xml files into SQL tables. Inspired from samples, I managed to do it for simple xml file like this, using a schema (at least I think this can be called a schema) XML file: <?xml version=&...
   Database Help (Home) -> XML All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]