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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:15:06+00:00 2026-06-12T22:15:06+00:00

Thank you in advance! I am working in SQL Server 2008 R2. What I

  • 0

Thank you in advance! I am working in SQL Server 2008 R2.

What I am trying to do is I have a text type column that has a first and last name and then shows a ^, what I want to do is capture that text leading up to the ^ (so essnetially the first and last name) and append it to the very bottom of another column (not replace) within the same table.

I have tried using charindex but I just receieve the index number and I can’t seem to get it to capture the text before the ^ appears, I just get the position of the ^ and also I am having a hard time appending this
text chunk to another text type column within the same table. For this I have been trying the updatetext function but it doesn’t seem to work. I have scrapped what I have tried thus far because I have gotten anywhere without errors.

So in summary:

I need to capture text at the beginning of a text data type column until it reaches a ^ symbol

Save that text to some sort of variable.

Place (append), along with slight additions, into another text data type column.

It seems like it should be simple but I am having a difficult time, Please make recommendations if possible.
Thank you.

  • 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-12T22:15:07+00:00Added an answer on June 12, 2026 at 10:15 pm

    First, let’s find the starting position of the ^ in col1:

    CHARINDEX('^', col1)
    

    We will then use LEFT to return the left part of the column by specifying the number of characters to return. However, since the ^ is at the starting position, we need to subtract 1.

    LEFT(col1, CHARINDEX('^', col1) - 1)
    

    We then use + (CONCAT in 2012+) to concatenate another column (col2) to this:

    col2 + LEFT(col1, CHARINDEX('^', col1) - 1)
    

    If you need to make other additions, you can separate the string values using a plus:

    'Hello' + ' ' + 'World'
    

    The final statement may look something like:

    SELECT col2 + LEFT(col1, CHARINDEX('^', col1) - 1) AS col
    

    Update

    If there are some values that do not have a ^, you will need a CASE statement to prevent receiving the “Invalid length parameter passed to the LEFT or SUBSTRING function” error:

    SELECT
      CASE
        WHEN CHARINDEX('^', col1) > 0
          THEN LEFT(col1, CHARINDEX('^', col1) - 1)
        ELSE col1
      END AS col
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a db (SQL server 2008), and have an interesting issue with
So I'm working on SQL Server 2008 and I have this query which should
I am working in SQL Server 2008. I am writing a stored procedure which
I'm working on a project involving C# and a SQL Server 2008 database. In
we have WinForms app which stores data in SQL Server (2000, we are working
I am developing an Windows pplication(using Visual Studio 2008,Sql server 2005). I have to
I have a SQL Server table that contains the following fields: SessionId (guid) Message
I'm working on ASP.Net MVC3 web-site with Entity Framework and SQL Server 2008 as
Why is this query not working in Sql Server 2008? Select Top @PageSize Skip
I am working on a cross tab query in SQL Server 2008. Everything 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.