|
Question : Cannot use 'convert' and 'case' in MS Access
|
|
Hi experts, Please find my query pasted below... I want to use the same query in MS Access... All my columns are 'char'
Not lookin for a work around... want the same query to run in MS Access...
What i am exactly looking for is an alternative for 'CONVERT' AND 'CASE'...
The following SQL works fine in MS SQL Server 2000
Create View Prodn_Cap as SELECT Product AS product_name, Grade AS grade, Sum(CONVERT(decimal(10,3), RTRIM(WeightKg) + '.' + RTRIM(weightGm))) AS production, Sum(CONVERT(decimal(10,3), RTRIM(PriceKd) + '.' + RTRIM(PriceFils))) AS total_price, Avg(CONVERT(decimal(10,3), RTRIM(PriceKd) + '.' + RTRIM(PriceFils))) AS average_price, Min(CONVERT(decimal(10,3), RTRIM(PriceKd) + '.' + RTRIM(PriceFils))) AS lowest_price, Max(CONVERT(decimal(10,3), RTRIM(PriceKd) + '.' + RTRIM(PriceFils))) AS highest_price, region, farmName FROM FarmDetails group by product, grade, region, farmName
Select CASE when (Convert(decimal(10),production)) > 100 Then Convert(varchar(20),(Convert(decimal(10,2),production / 100))) + ' Tons' Else Convert(varchar(20),production) + ' Kgs' End as "prod", production from prodn_cap
URGENT!!! Well only an alternative for 'CONVERT' AND 'CASE' in MS Access ASAP wud help...
Cheers, Rosh
|
|
Answer : Cannot use 'convert' and 'case' in MS Access
|
|
You can use CDbl() to convert something to a double, or CInt() for integers.
YUou can use Iif() instread of case statements like this:
iif(something >= something else; something; something else)
|
|
|
|