Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Adding [] brackets around field names for SQL Server

$
0
0
Re: Adding [] brackets around field names for SQL Server
Web Connection
Re: Adding [] brackets around field names for SQL Server
Dec. 4, 2012
11:46 am
3NR0P93WHShow this entire thread in new window
Gratar Image based on email address
From:Mike Roof
To:Matt Slay
Matt,

I don't your your specific need but... in general... You don't need those brackets just because you are sending to SQL Server. If you are using wwBusiness and have it properly setup to connect to SQL Server then you can send your "For Instance" query directly to the Query function of a wwBusiness subclass and it should return your cursor.


I am using wwBusiness to execute Select statements against SQL Server. I have tons of Select statements in my app from the time where it ran against FoxPro DBFs, but now I need these Sql Statements to run against SQL Server. I'm hoping someone has written a helpful function that would add brackets around all the table and field name in the query string.

Does anyone know of a custom FoxPro procedure or regex that will automatically add brackets around all the table and field names in a SQL Select statement string?

For instance:

Select mach_name, mach_num, orderFrom Machines Whereorder< 100

Needs to become:

Select [mach_name], [mach_num], [order] From [Machines] Where [order] < 100


I also have Joins, Order By, and Group By clauses in some of the Select statements that I need to get cleaned up as well.

I'm trying to avoid adding brackets manually, because for a while the SQL statements still need to run against DBFs tables, so I if add them now, it will break the DBF version of the app. I know there are other VFP vs. Sql Server issues that I must address, but this is the biggest one I am facing now.

HTML Help Builder

Viewing all articles
Browse latest Browse all 10393

Trending Articles