SELECT
ClientID,
ProfileID as [Profile ID],
Title,Name as [First Name],
Surname as [Last Name],
Lender,
Product,
LoanAmount as [Loan Amount],
DateCompleted as [Mortgage Completed Date],
Source as [Lead Source],
ERC as [Erc Date],
Casetype as [Case Type],
email,
HouseNameNum as Street,
Address1 as Street,
Address2 as Street,
Town as City,
(postcode1 + postcode2) as Postcode,
CAST('http://172.16.200.119/BPSAdmin/Legacy/CommTracking.aspx?ClientId='+ ClientID AS VARCHAR(100)) as [Perspectives Comms]
FROM Datatable
The error I receive is:
Conversion failed when converting the varchar value
'http://172.16.200.119/BPSAdmin/Legacy/CommTracking.aspx?ClientId=' to data type int
ClientID is an INT, however, I want to add some strings to the beginning of the field to create a hyperlink to the clients' file.
Any suggestions on how I can resolve this Cheers
I think you need to explicitly cast the client Id column by itself so just shift your cast over: 'http://172.16.200.119/BPSAdmin/Legacy/CommTracking.aspx?ClientId=' + cast(clientid as varchar)