Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9099331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:35:14+00:00 2026-06-17T00:35:14+00:00

Below is my Query in which im trying to combine multiple column values SELECT

  • 0

Below is my Query in which im trying to combine multiple column values

SELECT DISTINCT  CONVERT(varchar, Em.ADDR1) - CONVERT(varchar, Em.ADDR2) - CONVERT(varchar, Em.ADDR3) - CONVERT(varchar, Dm.DIST_NAME) - CONVERT(varchar,Sm.STATE_NAME)
- CONVERT(varchar, Cm.COUNTRY_NAME) AS Expr1
FROM            EMP_MST AS Em INNER JOIN
  DESIG_MST AS Dsgm ON Em.DESIG_NO = Dsgm.DESIG_NO AND Dsgm.COMPANY_NO = Em.COMPANY_NO INNER JOIN
  DEPT_MST AS Dptm ON Em.DEPT_NO = Dptm.DEPT_NO AND Dptm.COMPANY_NO = Em.COMPANY_NO INNER JOIN
  COUNTRY_MST AS Cm ON Em.COUNTRY_NO = Cm.COUNTRY_NO INNER JOIN
  STATE_MST AS Sm ON Em.STATE_NO = Sm.STATE_NO AND Em.COUNTRY_NO = Sm.COUNTRY_NO INNER JOIN
  DIST_MST AS Dm ON Em.DIST_NO = Dm.DIST_NO AND Em.STATE_NO = Dm.STATE_NO AND Em.COUNTRY_NO = Dm.COUNTRY_NO LEFT OUTER JOIN
  EMP_MST AS MEm ON Em.MANAGER = MEm.EMP_NO
WHERE        (1 = 1) AND (Em.EMP_NO LIKE '%%') AND (Em.COMPANY_NO = 1)

When I’m executing the Query , I’m getting

Error:

operand data type varchar is invalid for subtract operator in sqlServer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T00:35:16+00:00Added an answer on June 17, 2026 at 12:35 am

    As people have said it’s a bit hard to follow the exact query, but the specific issue, as the error states, is that you’re using a - operator on varchar columns.

    If you’re trying to concatenate varchar values you should be using the + operator, something like:

    SELECT DISTINCT  CONVERT(varchar, Em.ADDR1) + CONVERT(varchar, Em.ADDR2) + CONVERT(varchar, Em.ADDR3) + CONVERT(varchar, Dm.DIST_NAME) + CONVERT(varchar,Sm.STATE_NAME)
    + CONVERT(varchar, Cm.COUNTRY_NAME) AS Expr1
    

    If these columns are all varchar already you probably don’t need the CONVERT functions, either.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my query which i'm trying to use, select DISTINCT c.sno from Cards
I am trying to create a select query which will split a column values
I want to group the below query by GetSetDomainName and select the row which
I am trying to use the query below (which works perfectly), as a subquery
I have the query below which works great. SELECT `Despatch`.`DespatchNumber` , `Despatch`.`Product` , `Stock`.`ProductNumber`
I am trying to condense the below query which could have unlimited options based
In the below query I am trying to filter the records which has Type
I'm using Sql-Server, and I have the below query which returns all columns that
In old mysql code, I had a query below which worked perfectly which is
I am using the below query to return the names of artists which appear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.