General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL How UPDATE .. WHERE ..=Integer
Hello all VFP-SQL Professionals,
I wont change the price for some area in the ArtTab.dBF.
The area is the first two numbers of the ArtNo.
ArtTab.dBF
*+------+-----------+-------+
*|cArtNo|cText |nPrice |
*|c(6) |c(20) |n(10,2)|
*+------+-----------+-------+
*|110001|Shirt blue | 10.00|
*|110002|Shirt red | 10.00|
*|11....|Shirt .... | 10.00|
*|119999|Shirt .... | 10.00|
*|120001|Sweet blue | 12.00|
*|129999|Sweet .... | 12.00|
*|130001|Socks white| 3.00|
If the Fieldtype from ArtNo is character it is easy.
UPDATE ArtTab SET nPrice=9.00 WHERE SUBSTR(cArtNo,1,2)="11"
UPDATE ArtTab SET nPrice=2.90 WHERE SUBSTR(cArtNo,1,2)="13"
But unfortunately, my ArtNo is INTEGER (iArtNo).
I test this command, but VFP SQL don't like this technique.
UPDATE ArtTab SET nPrice=9.00 WHERE SUBSTR(STR(iArtNo),1,2)="11"
Can anyone help with the right SQL command for UPDATE.
Many thanks from me.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only