[MarkLogic Dev General] mlsql : sql:execute and sql:params (string length problem)

Arnaud Roch gundounet at hotmail.com
Thu Aug 26 00:22:18 PDT 2010





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 !
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20100826/9bac3e37/attachment.html 


More information about the General mailing list