Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is max size of sqlexec string?
Message
From
17/05/2006 13:29:51
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01122845
Message ID:
01122903
Views:
30
Great. Thanks. This looks like a great way to test this. I can write something similar against my own database, and just keep retesting with higher values for the replicate parameter to see if or when it fails.
Did you try anything larger than that?


>For MY big supprise this works (12600 bytes string):
>
>CLEAR
>sqlH  = SQLSTRINGCONNECT([Driver={SQL Server};DataBase=AladinFirm0120;Trusted_Connection=yes;Server=Boris])
>IF sqlH > 0
>   m1  = REPLICATE([SELECT * FROM Rab WHERE Rab.Id = 1]+CHR(13)+CHR(10),350)
>   ? LEN(m1)
>   IF SQLEXEC(sqlH,m1) < 0
>      AERROR(laerror)
>      MESSAGEBOX(laerror[1,2])
>   ENDIF
>ELSE
>      AERROR(laerror)
>      MESSAGEBOX(laerror[1,2])
>ENDIF
>SQLDISCONNECT(0)
>CLOSE ALL
>
>
>
>>Borislav,
>>
>>Thanks. I was thinking that.. thinking it was either 4K for nvarchar, or
>>8K for varchar.
>>
>>If anyone can confirm this would be great. I don't think I will run into this limit, but I need to test for it, and, if I do, then figure out a way to break up the statements and then maybe union the result.
>>
>>Also, if I could find the limit for VFP sql that would be great too.
>>I know that the vfp string size is virtually unlimited... limitation is not there. not sure about the length of a sql statement.
>>
>>
>>>I think it is 4K (not sure though)
>>>Because VFP use sp_executesql to execute your code and that SP requires nvarchar for parameters, and the maximum chars in nvarchars are 4000.
>>>
>>>
>>>>Kevin,
>>>>
>>>>I could. I could build the sql string (which I am reading in from vfp tables) and pass it as a parameter to the SP. Does that have an impact on the string limit, if there is one, or let me do something I couldn't do otherwise?
>>>>
>>>>One reason I'd rather avoid sp's - even though I know of their benefits, is that I want to be able to install this app, easily in multiple client sites, without modifying their database. I'm using Accountmate's VAM/SQL software, and when they come out with a new release of the software or database, I will have additional complexity to deal with if I add SP's, because then I'll have to modify the upgraded database.
>>>>
>>>>In any event though what I'm concerned about is running up into a limitation on the string size on a single sql command, so I'm hoping to find that out, whether via inline sql or SP.
>>>>
>>>>Thanks
>>>>
>>>>
>>>>>David,
>>>>>
>>>>>Have you considered using stored procedures?
>>>>>
>>>>>Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform