teamakesmefart
Technical User
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
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