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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:40:53+00:00 2026-06-06T14:40:53+00:00

UPDATE DB4010.dbo.EntityStagedData SET EntityData = ( SELECT geo.City + ‘ ‘ + geo.Description +

  • 0
UPDATE DB4010.dbo.EntityStagedData
SET
EntityData = (
    SELECT 
        geo.City + ' ' + geo.Description + ' ' + geo.Street + ' ' +
        geo2.City + ' ' + geo2.Description + ' ' + geo2.Street
    FROM DB4010.dbo.RouteTemplates templates
        INNER JOIN DB4010.dbo.RouteTemplateClients clients 
        ON clients.RouteTemplateID = templates.RouteTemplateID
        INNER JOIN DB4010.dbo.RouteTemplateStopMasters masters 
        ON masters.RouteTemplateClientID = clients.RouteTemplateClientID
        INNER JOIN DB4010.dbo.RouteTemplateStopDetails details 
        ON details.RouteTemplateStopID = masters.PickupStopID
        INNER JOIN DB4010.dbo.RouteTemplateStopDetails details2 
        ON details2.RouteTemplateStopID = masters.DeliveryStopID
        INNER JOIN DB4010.dbo.Geofences geo 
        ON geo.GeofenceID = details.GeofenceID
        INNER JOIN DB4010.dbo.Geofences geo2 
        ON geo2.GeofenceID = details2.GeofenceID
    WHERE clients.RouteTemplateID = DB4010.dbo.EntityStagedData.EntityID
)
WHERE EXISTS ( SELECT RouteTemplateID FROM DB4010.dbo.RouteTemplates )

This is giving me an error:

Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into
column ‘EntityData’, table ‘DB4010.dbo.EntityStagedData’; column does
not allow nulls. UPDATE fails.

I can’t, for the life of me, figure out how to update+Concatenate “EntityData” from the results of the inner Select statement…

  • 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-06T14:40:54+00:00Added an answer on June 6, 2026 at 2:40 pm

    I’ve made a few changes:

    • single-letter aliases for readability
    • fix to proprietary SQL Server UPDATE FROM syntax
    • elimination of uncorrelated WHERE EXISTS clause

    You may still need to decide what to do in cases where geo.City etc. contain NULL values. You may need to simply wrap the expression in COALESCE or filter NULL rows out of the join altogether.

    UPDATE s SET EntityData = 
            geo.City + ' ' + geo.Description + ' ' + geo.Street + ' ' +
            geo2.City + ' ' + geo2.Description + ' ' + geo2.Street
    FROM DB4010.dbo.EntityStagedData AS s
    INNER JOIN DB4010.dbo.RouteTemplateClients AS c
      ON c.RouteTemplateID = s.EntityID
    INNER JOIN DB4010.dbo.RouteTemplates AS t
      ON t.RouteTemplateID = c.RouteTemplateID
    INNER JOIN DB4010.dbo.RouteTemplateStopMasters AS m
      ON m.RouteTemplateClientID = c.RouteTemplateClientID
    INNER JOIN DB4010.dbo.RouteTemplateStopDetails AS d
      ON d.RouteTemplateStopID = m.PickupStopID
    INNER JOIN DB4010.dbo.RouteTemplateStopDetails AS d2 
      ON d2.RouteTemplateStopID = m.DeliveryStopID
    INNER JOIN DB4010.dbo.Geofences AS geo
      ON geo.GeofenceID = d.GeofenceID
    INNER JOIN DB4010.dbo.Geofences AS geo2 
      ON geo2.GeofenceID = d2.GeofenceID;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update Table1 set name = (select top 1 a.col from Table2 a where Table1.num
UPDATE: Solution at bottom. I recently switched from using a set up such as
UPDATE TABLE1 set TABLE1.col1 = TABLE2.col1 FROM TABLE2 INNER JOIN TABLE3 ON COL2 =
UPDATE users u JOIN (select count(*) as job_count, user_id from job_responses where date_created >
UPDATE `company` SET `itnumber` = '595959' WHERE (id = 932) So the value of
Update : This is no longer an issue from C# 6, which has introduced
UPDATE UPI_ATTRIBUTE SET SITE_INC ='0' WHERE USER_PROFILING_NAME IN ('CAR_IMPLICIT','CAR_EXPLICIT') Above is my query that
UPDATE mytable SET this = 'this' AND that = 'that' WHERE MATCH (items) AGAINST
Update In the wiki spirit of StackOverflow, here's an update: I spiked Joe White's
[Update]: my initial example doesn't reflect my problem. Updated the sample, hopfully it is

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.