pass larg xml file to sql procedure
wilk_u
Member Posts: 94
Hi,
i need to pass large xml file to sp in sql, tried:
- cant send xml file as parameter with adoConnection.parameters - no xml type in ado data types
- cant put command like EXEC function(XMLDoc.xml) cause nav crashes saying that text length exceeds string buffer size, also execute command form ado connection doesnt accept BigText
- tried to pass array of 1024 length text strings as ado parameter but then nav says array must be the same dimension, no matter if i set dimension to 10 [10x1024] or 1024 [1024x1024]
- tried to set adoCommand.CommandText(EXEC proc XmlDoc.xml) but also got an errror about string buffer size overflow
Did you guys find a solution to the similar problem? Any help will be very useful.
Regards
i need to pass large xml file to sp in sql, tried:
- cant send xml file as parameter with adoConnection.parameters - no xml type in ado data types
- cant put command like EXEC function(XMLDoc.xml) cause nav crashes saying that text length exceeds string buffer size, also execute command form ado connection doesnt accept BigText
- tried to pass array of 1024 length text strings as ado parameter but then nav says array must be the same dimension, no matter if i set dimension to 10 [10x1024] or 1024 [1024x1024]
- tried to set adoCommand.CommandText(EXEC proc XmlDoc.xml) but also got an errror about string buffer size overflow
Did you guys find a solution to the similar problem? Any help will be very useful.
Regards
0
Comments
-
This may not be the most elegant solution, but it's the first one that popped into my head: save the XML to a blob field in SQL before calling the proc, then just pass the record ID of the blob to the stored proc. The proc can then just read the XML from the database instead of receiving it as a parameter.
- Mark0 -
Thanks for answer, trying this i encounter a problem, sql throws an obvious error, cannot convert blob to xml which is a column in the table. Is there any way to convert it via sql?
Regards0 -
You should be able to use CONVERT in SQL to switch to/from XML, though you shouldn't need to (should be an implicit conversion). If you created the blob field as an "image" field, you won't be able able to convert to XML.0
-
Hello,
you mean changing field type in nav from blob to binary? Then it's only 250 chars..
Can you please explain this in more detail? Thank you0 -
Yes, change the field type. Binary and varbinary can be 8K, or you could use a text field - basically the text equivalent of an image field (2GB storage).
If you're using a newer/current version of SQL, use varchar(max) instead of text - it also has 2GB storage.0 -
Part which is a problem for me, what field type do you mean to choose in navision to be able to convert it to xml?
Procedure gets the record from navision table which has i.e field MyXml and converts that field to xml and does some stuff with it.
Point is, MyXml field can't be a blob, i can fit whole xml in it but can't convert it to xml in sql procedure cause blob is an image type in sql
Binary field in Navision is only 250 chars so it's to small.
What type of field in navsion do you mean?
Regards0 -
are you sure the compression is not enabled on the blob field you are trying to use?0
-
Compression property and casting directly from binary to xml made the job. Thanks guys!0
-
I managed to convert file and put it in sql table, but when running this procedure from navision - nav freezes on sqlCommand.execute
SQLCommand := STRSUBSTNO('EXEC getXmlFile %1', LastNo); ADOConnection.Execute(SQLCommand);
LastNo is ans int value, xml no.
Procedure:ALTER procedure [dbo].[getXmlFile] (@no int) AS declare @myxmlasblob varbinary(max) declare @myxml xml set @myxmlasblob = (select [xml] FROM NAV.dbo.[xmlTable] where [No] = @no) set @myxml = (select CONVERT(xml,@myxmlasblob)) insert into tableToInsert (XmlFieldInThatTable) select @myxml
through sql mgmt studio on the same user and with the same argument everything works perfectly.
Any hints?
Thank you guys0 -
Any hints on that?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions