Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL - Conversion failed when converting the varchar value to data type int

Hello, i'm trying to build an MS SQL query, like so -

Select
('/job-search.asp?s=' + JBCID) AS URLOne,
('/job-search.asp?s=' + JBCID + '&' + JBCategoryLabel + '-jobs-in=XXXXX') AS URLTwo,
('/job-search/s-' + JBCID + '/' + JBCategoryLabel + '-jobs-in=XXXXX') AS URLThree,
('/' + JBCategoryLabel + '-jobs-in=XXXXX') AS URLFour
from dbo.JBCategories C Inner Join dbo.JBSite S on C.JBCSiteID = S.JBSSiteID
where JBCSiteID = 30

However when i run the query I get the following error -

Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value '/job-search.asp?s=' to data type int.

Please advise what i have done wrong? Many thanks
ASKER CERTIFIED SOLUTION
Avatar of Daniel Reynolds
Daniel Reynolds
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

superb, thank you both
:) spot on