Ok, I understand !
I see what you mean, I'll change the way that my function process, take the
type info from my sql table to work on.
Thank you !
From: [email protected]
Date: Thu, 26 Aug 2010 10:35:51 -0700
To: [email protected]
Subject: Re: [MarkLogic Dev General] mlsql : sql:execute and sql:params (string
length problem)
It looks like SQL Server just doesn't like the string you've constructed. You
should print out the string you're sending and see if it works when directly
typed to SQL Server. I bet it won't, and you might be able to see the problem
there.
I notice you're not escaping special characters so that could be a cause (it's
a security risk regardless).
The latest MLSQL supports bind parameters which you might want to use instead.
Safer, shorter.
-jh-
On Aug 26, 2010, at 12:22 AM, Arnaud Roch wrote:Hi,
I want to insert to an SQL server database a large amount of data.
My query is like "INSERT INTO [dbo].[Table] ([Field1],[Field2],...,[FieldN])
VALUES (Value1,Value2,...,ValueN). I'd near 1750 character.
My Xquery look like this :
for $p in //Product
return
sql:execute(
"?",
"http://serverIP:8080/mlsql/mlsql",
sql:params (
fn:concat("INSERT INTO [dbo].[", fn:local-name($p),"] (",
fn:string-join (
(
for $e in $p/*, $l in $p/*[fn:last()]
return fn:concat("[",fn:local-name($e),"]",
if (fn:local-name($e) != fn:local-name($l))
then "," else ""),
") VALUES (",
for $e in $p/*, $l in $p/*[fn:last()]
return fn:concat($e,
if (fn:local-name($e) != fn:local-name($l))
then "," else ""),
")"
)
,"")
)
)
)
When I run it, it throw me this
<sql:result xmlns:sql="http://xqdev.com/sql">
<sql:meta>
<sql:exceptions>
<sql:exception type="com.microsoft.sqlserver.jdbc.SQLServerException">
<sql:reason>
The name 'INSERT INTO [dbo].[Table] ([Field1], [Field2]...,[Field' is not a
valid identifier.
</sql:reason>
<sql:sql-state>S0002</sql:sql-state>
<sql:vendor-code>203</sql:vendor-code>
</sql:exception>
</sql:exceptions>
</sql:meta>
</sql:result>
I look at the string length and I found that the returned string had 644
characters.
So I've deducted that 1 param "?" have a limited string length .
Is there a way to increase this string length value ?
I have the same problem with my functions to make the same type of query and
wich return a 1750 characters query !
Thank you !
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general