String for Pass Through command too long 
Author Message
 String for Pass Through command too long

I am trying to create a table in SQL using the SQLEXEC command.

I build the command,

SQLCREATE = "Create table test(name...)" and execute the command
SQLEXEC(fhandle,&SQLCREATE)

Of course when the string goes over 254 I get a FoxPro error.

What I can't think of is a way to build a command to pass to SQL that will
be longer than 254 character.

I guess I could build the table and then send a bunch of ATLER TABLE
command, but there must be a better way.

Any ideas?

TIA

dan



Sat, 29 Jan 2005 23:22:32 GMT  
 String for Pass Through command too long
Dan,
The 254 character limit is only because you are trying to create the entire
command in a single constant string. If you break it up into multiple pieces
then I believe the next thing you'll run into is the 8,192 character limit
(?) for the parameter to SQLEXEC().
e.g.
SQLCREATE = "Create table test(field1 ... , " ;
  +"field2 ...., " ;
  +"field3 ...., " ;
...
 + "fieldlast ... )"

If you are working in VFP 7.0, there's even an easier way - use the new
textmerge to variable option
e.g.
TEXT TO SQLCREATE NOSHOW TEXTMERGE
Create table test(field1 ...,
  field2 ....,
  field3 ....,
...
 fieldlast ... )
ENDTEXT

Note: Depending on the backend, you may need to strip out the CRLFs in this
example.

Rick


Quote:
> I am trying to create a table in SQL using the SQLEXEC command.

> I build the command,

> SQLCREATE = "Create table test(name...)" and execute the command
> SQLEXEC(fhandle,&SQLCREATE)

> Of course when the string goes over 254 I get a FoxPro error.

> What I can't think of is a way to build a command to pass to SQL that will
> be longer than 254 character.

> I guess I could build the table and then send a bunch of ATLER TABLE
> command, but there must be a better way.

> Any ideas?

> TIA

> dan



Sun, 30 Jan 2005 01:00:31 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. pass a long string to a procedure??

2. Long macro command string

3. Passing a long SQl select command to SQLEXEC

4. Long, long character string

5. Help: String to Long to fit!

6. STRTRAN() to fix ASCII: Error 1903: String is too long to fit

7. String too long in PICTURE "@M"

8. ?? long strings?

9. string to long error

10. Beware the String Too Long To Fit

11. Long string problems

12. Help Anyone (who has experience processing Long Ascii Strings)

 

 
Powered by phpBB® Forum Software