strSQL = "SELECT * FROM Products WHERE price = 0;"
Some 'best practice' asides:
1) Never use SELECT * in production code.
2) Be consistent as regards data types, decimal scale, etc e.g. (air
code)
CREATE TABLE Products (
product_name VARCHAR(20) NOT NULL UNIQUE,
price CURRENCY DEFAULT 0.0000 NOT NULL
)
;
SELECT product_name, price
FROM Products
WHERE price = CCUR(0.0000)
;
It may make you think about whether you need exactly four decimal
places.
3) Use a SQL PROCEDURE to which strongly-typed parameter values may be
passed e.g.
CREATE PROCEDURE GetProductsByPrice (
arg_price CURRENCY = 0.0000
)
AS
SELECT product_name, price
FROM Products
WHERE price = arg_price
;
Currencytypes are in simplest terms formated numbers.
I think "formatted numbers" may be an oxymoron <g> but I agree
CURRENCY does have implications for 'formatting' that may or may not
be appropriate for the purposes to which it is put (for me a
'currency' column means the ISO 4217 three letter codes e.g. 'USD').
The most basic point is that CURRENCY is a fixed point *exact* decimal
numeric type (DECIMAL is the other more flexible one), as distinct
from the floating point *approximate* numeric types (Single, Double)
which are most inappropriate for money data.
Jamie.
--