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 8527615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:36:24+00:00 2026-06-11T08:36:24+00:00

I have a table, MapLocation, which has a column and two relationships with tables

  • 0

I have a table, MapLocation, which has a column and two relationships with tables that have a field that really need to be displayed as a single concatenated value. I was thinking this was a perfect case for a computed column, but not sure how to go about it.

 MapLocation                          MaoNo                         Section   
_____________________                 _____________________         _____________________
 MapNoId                              MapNoId                       SectionId
 SectionId                            MapNumber (int)               Section (int)
 Identifier (nvarchar)
 LocationName (nvarchar)

LocationName = “MapNUmber – SectionNumber – Identifier”
ex: 20 – 03 – SW4

How would I write that? I haven’t done much with computed columns or concatenating in SQL.

Edit:

I need an actual computed column that is automatically updated, im looking for the formula. Or is this more of a function/trigger? Its possible, I certainly barely know what I’m doing. The idea is that I dont want to have to do two more server calls and concatenate these values client side.

  • 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-11T08:36:25+00:00Added an answer on June 11, 2026 at 8:36 am

    You would use something like this to get the value:

    select cast(n.MapNumber as nvarchar(10)) + ' - '   -- cast the MapNumber 
        + cast(s.SectionId as nvarchar(10)) + ' - '    -- cast the SectionId 
        + l.Identifier  
    from MapLocation l
    left join MaoNo n
        on l.MapNoId  = n.MapNoId 
    left join Section s
        on l.SectionId = s.SectionId
    

    Then if you need to perform an UPDATE:

    update l
    set l.LocationName =  (cast(n.MapNumber as nvarchar(10)) + ' - '    
                        + cast(s.SectionId as nvarchar(10)) + ' - '   
                        + l.Identifier)
    from MapLocation l
    left join MaoNo n
        on l.MapNoId  = n.MapNoId 
    left join Section s
        on l.SectionId = s.SectionId
    

    Edit #1 – you can use a TRIGGER:

    CREATE TRIGGER trig_LocationName
    ON MapLocation
    AFTER INSERT
    AS
    Begin
        update MapLocation
        set LocationName =  (cast(n.MapNumber as nvarchar(10)) + ' - '    
                                            + cast(s.SectionId as nvarchar(10)) + ' - '   
                                            + i.Identifier)
        from Inserted i
        left join MaoNo n
            on i.MapNoId  = n.MapNoId 
        left join Section s
            on i.SectionId = s.SectionId
        where MapLocation.MapNoId  = i.MapNoId  -- fields here to make sure you update the correct record
    End
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table in MS Access that has an AutoNumber type in field ID
I have table with column Percentage varchar(10) Data in that table is Pecentage 2/10
I have table in my database which has fields of ID,NAME,CONTEXT. I am showing
I have table categories (c) and an another table (x) with a column which
I have table TB1 which has the following cols: ID | date --------------------- 1
I have table with a name filed which is string. I need to create
I have table called FinalForgotten which only contains one field called aname. The field
I have table named as contacts which has nearly 1.2 million records we use
i have table with two fields competition {stateTime, endTime} when i insert to that
I have table with around 70 000 rows. There is 6000 rows that i

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.