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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:03:02+00:00 2026-05-30T22:03:02+00:00

If you will look at the image above. I need to update this table

  • 0

data

If you will look at the image above. I need to update this table for the null values of the TID which is column third in the table, with the values in between two rows that actually has value.

So in the above example, I need to have rows 44-57 as 040, row 60-87 as 077 etc. One pattern that could be used is that column 2 has INS in the string, which denotes that the value in column 3 is to be changed. So I was thinking about using DATA LIKE ‘INS%’ in some way.

Please let me know what you think of the problem and any possible solutions.

thanks!

  • 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-30T22:03:04+00:00Added an answer on May 30, 2026 at 10:03 pm
    DECLARE @x TABLE
    (Column1 INT, Column2 VARCHAR(64), TID VARCHAR(10));
    
    INSERT @x VALUES
    (42, 'INS{whatever}', '040'),
    (43, 'somethingelse', '040'),
    (44, 'somethingelse', NULL),
    (45, 'somethingelse', NULL),
    (46, 'somethingelse', NULL),
    (47, 'somethingelse', NULL),
    (48, 'somethingelse', NULL),
    (49, 'INS{whatever}', '077'),
    (50, 'somethingelse', '077'),
    (51, 'somethingelse', NULL),
    (52, 'somethingelse', NULL);
    
    ;WITH x AS (SELECT i = Column1, TID, rn = ROW_NUMBER() OVER (ORDER BY Column1)
        FROM @x WHERE Column2 LIKE 'INS%'
    ),
    y AS (SELECT x.TID, s = x.i, e = COALESCE(x2.i, 2000000000)
    FROM x LEFT OUTER JOIN x AS x2 ON x.rn = x2.rn -1
    )
    UPDATE src SET TID = y.TID
    FROM @x AS src
    INNER JOIN y ON src.Column1 > y.s AND src.Column1 < y.e;
    
    SELECT * FROM @x;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to create a login screen in android that will look like this.
If you look closely at the image above you will see a hit box
So the final menu will look something like this: Item B Item B-1 Item
I need a tool that will look at a Microsoft SQL Server database and
I need to simulate how my application will look when a user is driving
I am creating a container of JComponents which will look like a piano keyboard.
I am developing a web site and need to see how it will look
So, sometimes, my output will look like this: <p><img src=someimage.jpg /></p> <p>A new paragraph</p>
ssh will look for its keys by default in the ~/.ssh folder. I want
Is there a good tool that will look at a .NET assembly and tell

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.