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

  • SEARCH
  • Home
  • 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 6962353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:38:59+00:00 2026-05-27T15:38:59+00:00

I have the following table: ApprovalOrder EntityCode ProjectCode 1 1415 NULL 2 1415 NULL

  • 0

I have the following table:

ApprovalOrder EntityCode ProjectCode

1 1415 NULL

2 1415 NULL

3 1415 NULL

And the following code:

    select 
        de.ApprovalOrder + de. EntityCode + isnull(de.ProjectCode, '') as 'RowID'
    from workflow.delegation_engine de
    where EntityCode = 1415 and DelegationCode = 'CAT1'

Which is unfortunately returning an additive result. I’m aware this is what it should do given the above however how can I make it concatenate the result of each column into one result whilst also only including de.ProjectCode when the result it not NULL (this can be characters or integer values).

For example, if I was running query just on the first row of this table I’d like the returned result to be ‘11415’.

  • 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-05-27T15:38:59+00:00Added an answer on May 27, 2026 at 3:38 pm

    To be explicit about what you are doing, I would cast each item to a VARCHAR() first.

    CAST(de.ApprovalOrder AS VARCHAR(16)) + CAST(de.EntityCode AS VARHCAR(16)) + ISNULL(CAST(de.ProjectCode AS VARCHAR(16)), '')
    

    If you want a hack to avoid the explicit casting, start the derivation with a string…

    '' + de.ApprovalOrder + de.EntityCode + ISNULL(de.ProjectCode, '')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table: mysql> SELECT * FROM temp; +----+------+ | id |
I have the following table structure CREATE TABLE `table` ( `id` int(11) NOT NULL
I have the following table >Anna from to values 5 10 34 10 14
I Have the following table: CREATE TABLE `tmp_table` ( `id` int(11) NOT NULL AUTO_INCREMENT,
I have following table and data: create table Foo ( id int not null,
I have the following table CREATE TABLE [dbo].[LogFiles_Warehouse]( [id] [int] IDENTITY(1,1) NOT NULL, [timestamp]
I have following table CREATE TABLE User ( email sysname NOT NULL, sign varbinary(256)
I have the following table structures CREATE TABLE [dbo].[WorkItem]( [WorkItemId] [int] IDENTITY(1,1) NOT NULL,
We have the following table: CREATE TABLE [dbo].[CampaignCustomer]( [ID] [int] IDENTITY(1,1) NOT NULL, [CampaignID]
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party

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.