Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with long string in an SQL statement
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00582595
Message ID:
00582618
Views:
29
Hi Chris,

I know what you mean... I've tried macro subbing individual where clause segments before...

I don't know if it will help but you could try the following...

1) Store the entire SQL Statement as a variable and run it with Macro substitution...

e.g.

LOCAL lcSQLCmd
lcSQLCmd = "SELECT Customers.* FROM Customers WHERE "+ ;
lcSurname+ ;
" AND "+lcDepartment && etc...

&lcSQLCmd.

2) Store the entire WHERE clause to a variable and macro sub that.

e.g.

LOCAL lcWhere
lcWhere = lcSurname+ ;
" AND "+lcDepartment && etc...

SELECT * FROM Customers
WHERE &lcWhere.


I've also found that when using macro substitution where tables or table aliases are concerned that ending the macro sub with a full stop helps. I think it can confuse fox at times if there isn't one present, certainly in SQL statements.

I think string length will effect you the way you are firing your SQL statement now but I haven't had problems working the ways above.

HTH

Ben
Ben Sugden

"Remember to enjoy hunting - and that means relishing the search for the product that has never been advertised or placed handily at the front of the shop; Life begins on the uppermost shelf, avoid guide books and top 10's like the plague." - Ramsey Dukes
Previous
Reply
Map
View

Click here to load this message in the networking platform