I am enhancing a Visual FoxPro batch program with a .prg extension. I am
specifically changing the SQL so I'd like to comment within the SQL. That
being said, should my comment be prefaced with "--" designating SQL comments,
or "*" designating FoxPro comments???

Thanks in advance for your help.

PSULionRP

Re: Embedded SQL and comments by Anders

Anders
Fri Apr 04 15:27:59 CDT 2008

You can put comments after a * at the star of line, thus before or after the
SQL command.

You can add && comments after ; line continution symbols inside the SQL
command

* comment 1
SELECT ; && comment 2
col1, col2, ;
SUM(col3 ), ;
SUM (col4) ; && optional! (comment 3)
FROM Table1
* comment 4


-Anders

"PSULionRP" <PSULionRP@discussions.microsoft.com> wrote in message
news:10AC7648-6BDB-485A-B275-A16823985610@microsoft.com...
>I am enhancing a Visual FoxPro batch program with a .prg extension. I am
> specifically changing the SQL so I'd like to comment within the SQL. That
> being said, should my comment be prefaced with "--" designating SQL
> comments,
> or "*" designating FoxPro comments???
>
> Thanks in advance for your help.
>
> PSULionRP




Re: Embedded SQL and comments by swdev2

swdev2
Fri Apr 04 16:41:23 CDT 2008

I don't take that approach.
I'll copy the entire sql block to a new area/line, comment out the old sql
block in it's entirety, also put date/time stamp in the comments, along with
yer initials, cause -
USUALLY
a sql block code change occurs,
IN A PRODUCTION SYSTEM
because of BUSINESS RULE CHANGE.

You'll want to document that change, everwhere you are, in case the phb's
CHANGE THEIR MINDS AGAIN.

If you are thinking about using "--", then is this STRAIGHT SQL for VFP,
or SQL to be PASSED into a backend server using odbc ? (My thought is SPT,
btw)

Regards [Bill]

--
===================
William Sanders / EFG VFP / mySql / MS-SQL
www.efgroup.net/vfpwebhosting
www.terrafox.net www.viasqlserver.net

"PSULionRP" <PSULionRP@discussions.microsoft.com> wrote in message
news:10AC7648-6BDB-485A-B275-A16823985610@microsoft.com...
> I am enhancing a Visual FoxPro batch program with a .prg extension. I am
> specifically changing the SQL so I'd like to comment within the SQL. That
> being said, should my comment be prefaced with "--" designating SQL
comments,
> or "*" designating FoxPro comments???
>
> Thanks in advance for your help.
>
> PSULionRP



Re: Embedded SQL and comments by PSULionRP

PSULionRP
Fri Apr 04 15:41:00 CDT 2008

So I cannot imbed comments within the SQL then??? Like so...


SELECT col1,
col2,
-- Add col3
col3
FROM Table1



"Anders Altberg" wrote:

> You can put comments after a * at the star of line, thus before or after the
> SQL command.
>
> You can add && comments after ; line continution symbols inside the SQL
> command
>
> * comment 1
> SELECT ; && comment 2
> col1, col2, ;
> SUM(col3 ), ;
> SUM (col4) ; && optional! (comment 3)
> FROM Table1
> * comment 4
>
>
> -Anders
>
> "PSULionRP" <PSULionRP@discussions.microsoft.com> wrote in message
> news:10AC7648-6BDB-485A-B275-A16823985610@microsoft.com...
> >I am enhancing a Visual FoxPro batch program with a .prg extension. I am
> > specifically changing the SQL so I'd like to comment within the SQL. That
> > being said, should my comment be prefaced with "--" designating SQL
> > comments,
> > or "*" designating FoxPro comments???
> >
> > Thanks in advance for your help.
> >
> > PSULionRP
>
>
>
>

Re: Embedded SQL and comments by tg

tg
Fri Apr 04 15:40:40 CDT 2008

PSULionRP schrieb:
> I am enhancing a Visual FoxPro batch program with a .prg extension. I am
> specifically changing the SQL so I'd like to comment within the SQL. That
> being said, should my comment be prefaced with "--" designating SQL comments,
> or "*" designating FoxPro comments???
>
> Thanks in advance for your help.
>
> PSULionRP

Select ; && beware, a vfp style commented select
myfield as mycursfield ; && why in hell do I change names
, count(*) as cunt ; && hidden sexism
from (tcTable) ; && see parameter statement
group by 1 ;
into cursor T_myCurs


Re: Embedded SQL and comments by PSULionRP

PSULionRP
Fri Apr 04 15:54:00 CDT 2008

Straight SQL. I just wasn't sure if Visual FoxPro would like the "--" comment
parsers or not.

"swdev2" wrote:

> I don't take that approach.
> I'll copy the entire sql block to a new area/line, comment out the old sql
> block in it's entirety, also put date/time stamp in the comments, along with
> yer initials, cause -
> USUALLY
> a sql block code change occurs,
> IN A PRODUCTION SYSTEM
> because of BUSINESS RULE CHANGE.
>
> You'll want to document that change, everwhere you are, in case the phb's
> CHANGE THEIR MINDS AGAIN.
>
> If you are thinking about using "--", then is this STRAIGHT SQL for VFP,
> or SQL to be PASSED into a backend server using odbc ? (My thought is SPT,
> btw)
>
> Regards [Bill]
>
> --
> ===================
> William Sanders / EFG VFP / mySql / MS-SQL
> www.efgroup.net/vfpwebhosting
> www.terrafox.net www.viasqlserver.net
>
> "PSULionRP" <PSULionRP@discussions.microsoft.com> wrote in message
> news:10AC7648-6BDB-485A-B275-A16823985610@microsoft.com...
> > I am enhancing a Visual FoxPro batch program with a .prg extension. I am
> > specifically changing the SQL so I'd like to comment within the SQL. That
> > being said, should my comment be prefaced with "--" designating SQL
> comments,
> > or "*" designating FoxPro comments???
> >
> > Thanks in advance for your help.
> >
> > PSULionRP
>
>
>

Re: Embedded SQL and comments by Anders

Anders
Sat Apr 05 05:43:00 CDT 2008

VFP doesn't support -- for comments anywhere. If you're sending off the sql
as a string to some other backend, I can't say; you'd better test it. VFP
does parse even this sort of string placed in a SQLEXEC() function and turns
embedded ?varable or ?vfpfunction(), and &macro variables, into literal
values, before passing it on to the ODBC layer.

-Anders

"PSULionRP" <PSULionRP@discussions.microsoft.com> wrote in message
news:4E5204F2-F59B-476B-AEB6-F6BE4AAA19FD@microsoft.com...
> Straight SQL. I just wasn't sure if Visual FoxPro would like the "--"
> comment
> parsers or not.
>
> "swdev2" wrote:
>
>> I don't take that approach.
>> I'll copy the entire sql block to a new area/line, comment out the old
>> sql
>> block in it's entirety, also put date/time stamp in the comments, along
>> with
>> yer initials, cause -
>> USUALLY
>> a sql block code change occurs,
>> IN A PRODUCTION SYSTEM
>> because of BUSINESS RULE CHANGE.
>>
>> You'll want to document that change, everwhere you are, in case the phb's
>> CHANGE THEIR MINDS AGAIN.
>>
>> If you are thinking about using "--", then is this STRAIGHT SQL for VFP,
>> or SQL to be PASSED into a backend server using odbc ? (My thought is
>> SPT,
>> btw)
>>
>> Regards [Bill]
>>
>> --
>> ===================
>> William Sanders / EFG VFP / mySql / MS-SQL
>> www.efgroup.net/vfpwebhosting
>> www.terrafox.net www.viasqlserver.net
>>
>> "PSULionRP" <PSULionRP@discussions.microsoft.com> wrote in message
>> news:10AC7648-6BDB-485A-B275-A16823985610@microsoft.com...
>> > I am enhancing a Visual FoxPro batch program with a .prg extension. I
>> > am
>> > specifically changing the SQL so I'd like to comment within the SQL.
>> > That
>> > being said, should my comment be prefaced with "--" designating SQL
>> comments,
>> > or "*" designating FoxPro comments???
>> >
>> > Thanks in advance for your help.
>> >
>> > PSULionRP
>>
>>
>>



Re: Embedded SQL and comments by Olaf

Olaf
Sat Apr 05 06:58:07 CDT 2008

> SELECT col1,
> col2,
> -- Add col3
> col3
> FROM Table1

No you can't do that.
VFP does only support * and && for comments,
also within SQL commands.

* does not work, as it's always needed as the
first character of a line to be a comment line begin
and so it does not allow you to put line continuation ;
before it, but you can make a comment line in a
command by starting a line with ;&&

So you could do:

SELECT col1, ;
col2, ;
;&& Add col3
col3 ;
FROM Table1

I'd take Bills Advice though. Take the previous SQL
in a comment block, then add a comment header
to your new sql block and then the new sql.

Bye, Olaf.