Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculated column does not work in SQL Server 1

Status
Not open for further replies.

pss08

Programmer
Mar 10, 2006
7
ES
I have a simple SQL Select command with a calculated column that it is working for years in an Access database. Now passing this same Select to SQL Server does not work.

SELECT Invoice.Date,Invoice.Name,Invoice.Total,.....

and this is the calculated column:

(Invoice.Paid + Invoice.TotalTax * Abs(Invoice.Paid > 0) * Abs(Invoice.PayType <> 'EFP'))"

Explanation: Invoice.TotalTax allways has some positive value, but Invoice.TotalTax must be changed to 0 if Invoice.Paid is 0, or if Invoice.PayType is 'EFP'

Any help to solve this in SQL Server.
 
Code:
(Invoice.Paid + Invoice.TotalTax * 
 CASE WHEN Invoice.Paid <= 0 OR Invoice.PayType = 'EFP' THEN 0
      ELSE 1 END)

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top