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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Typecasting in Paradox SQL

Status
Not open for further replies.

teamakesmefart

Technical User
Dec 3, 2003
10
GB
Hi All

I want to perform a SQL select where the contents of a string appear
within a numerical field.

So I presume I need to use CAST to typecast the numeric field to a
String/Varchar/Char/Character (or something)

So if I wanted to search for all Policies which contained the digit 1
in the Policy Number, I'd end up with something like:

SELECT c.claimID, c.policyID, p.policyID, p.InsuredID, i.insuredID,
i.Name
FROM Insured i, Policies p, Claims c
WHERE CAST(c.claimID AS [/b]VARCHAR(3)[/b]) LIKE '%1%'
AND p.policyID = c.policyID
AND p.insuredID = i.insuredID

Could somebody please tell me if this is right - and what the correct
syntax and destination data type for my CAST statement should be please?

Currently I receive the error: "Type mismatch in expression"


Thanks in advance
Pete Wright
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top