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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:35:14+00:00 2026-06-04T12:35:14+00:00

I have created a new column in my table(table1) . I am trying to

  • 0

I have created a new column in my table(table1) . I am trying to populate it with data from another table, table2.

Table1 has a column called ‘Name’. ‘Name’ contains a substring indicating the language of the column. I wish to compare this substring with the ‘Language’ column of table2, which contains the substring in the name column and insert the corresponding LanguageID into my new column.

So, for instance :

table1
Name
xxXxxxXxxxxxzxzxzxz xxxazxzxxXXXZxxzxzx 2183909213 ENG-UK nfjksdnfnd 723984782347

and table2 :

table2
    Language | ID 
    ENG-uk   | 1

In the table1 name column, the string before and after the Language can take any form, a varying number of characters. The language will always have a space before and after it.

So, I want to end up with :

table1
Name  | LanguageID
xx... | 1

I have this query which I believe should work :

INSERT INTO table1 (LanguageID) 
SELECT t2.ID FROM table2 t2, table1 t1 WHERE CHARINDEX(LOWER(t2.Language), LOWER(t1.Name)) != null

The problem is, when I run this….”(0 row(s) affected)”, which should not be the case.

Does anyone have any ideas ?

  • 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-04T12:35:16+00:00Added an answer on June 4, 2026 at 12:35 pm

    The reason that you don’t get any matches at all is that you can’t use the != operator to compare null values, you have to use is not null for that.

    However, that will give you a very big result, as the return value from charindex is never null. When the string isn’t found it returns zero, so that is what you should compare against.

    Also, you can’t insert columns, you have to first add the column to the table, then update the records:

    update t1
    set LanguageID = t2.ID 
    from table1 t1
    inner join table2 t2 on charindex(lower(t2.Language), lower(t1.Name)) != 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a new table including a column note. The default is varchar(255)
I have created a new project in Ios5 using storyboards and my project has
I have created a new MVC3 project and used the ADO.NET Entity Data Model
I have an SSIS package that exports data from a table on a SQL
I am trying to copy data from an old database into a new one,
I have created a new Bitmap object and now want do draw some text
I have created a new Facebook app. Whenever I visit the canvas page (https://apps.fac...)
I have created a new project in XCode (using the template STL C++ library),
I have created a new SharePoint 2007 MOSS Intranet. Our admin people are purchasing
I have created a new method in one of the project's controllers that it

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.