🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #497

Using a variable replacement in SQL

#497
From: Bob Knapp
Date: Wed, 02 Sep 1998 00:00
39 lines
1598 bytes
Hello

I am trying to perform the UPDATE function with SQL in dbase 7.01. What
I would like to do is replace all values in a field when a match is
made.

My understanding is that the update command works as follows  UPDATE
<table name> SET <colum name> = <expression> WHERE <search condition>.

This command works fine from dbase :

UPDATE  DATA1.DBF  SET VALUE1 = '1000'  WHERE  VALUE2 = 'TEST'

All VALUE1 occurances are changed to 1000 when VALUE2 is equal to TEST.

The problem is this: In the real world '1000' and 'TEST' are being sent
in as variables and changed all the time.

If I set these values to variables it won't work .  ie. TEMP1 = '1000'
,  TEMP2 = 'TEST'

        UPDATE DATA1.DBF SET VALUE1=TEMP1 WHERE VALUE2=TEMP2


I  even tried to use &TEMP1 and &TEMP2 as well as '&TEMP1' and '&TEMP2'.

Nothing seems to work and there is little or no information on how to
use SQL with a variable replacement.

What is the secret syntax, or does visual dbase not support common SQL
language.

This seems to be a simple problem but the syntax eludes me.


Thanks for help in this area,


Bob Knapp
Technical Details
Message-ID: <35ED6C73.CA7B92E@erols.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,3529dd9d0cb9d0ba,start
X-Google-Attributes: gidff5a1,public
From: Bob Knapp <nectel@erols.com>
Subject: Using a variable replacement in SQL
Date: 1998/09/02
Message-ID: <35ED6C73.CA7B92E@erols.com>
X-Deja-AN: 387170518
Content-Transfer-Encoding: 7bit
Organization: NecTel
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.vdbase.data.sql