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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:56:59+00:00 2026-05-29T06:56:59+00:00

I need to write a query to get a list of users where their

  • 0

I need to write a query to get a list of users where their fullname is in an attribute named description. User names are kept in that attribute in any of the format:-

  • LASTNAME Firstname
  • LASTNAMEFirstname (without space)
  • FirstnameLastname

In such a scenario if I need to search a given list of users(around 100) in that attribute, I have to write query like
select * from dm_user where UPPER("description") like '%FIRSTUSER_FIRSTNAME%' OR UPPER("description") like '%SECONDUSER_FIRSTNAME%' and so on..

Is their a way I can do things more simply.I hate writing *UPPER("description") like* 100 times.(Please suggest standard sql query).
I need to run this query on Documentum and MSSQL.

I just want to have something like

{

select * from dm_user 
where UPPER("description") 
like IN ('%FIRSTUSER_FIRSTNAME%','%SECONDUSER_FIRSTNAME%');

but its not available in documentum}

  • 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-29T06:57:00+00:00Added an answer on May 29, 2026 at 6:57 am

    Can use use dynamic queries and let SQL Server to write those strings 100 times?

    --DROP TABLE #User
    -- This is an EXAMPLE: keep using your names source
    CREATE TABLE #User(Id int, Name varchar(50))
    INSERT INTO  #User VALUES (1, 'First')
    INSERT INTO  #User VALUES (2, 'Second')
    -- ... and so on
    
    DECLARE @Query nvarchar(max)
    SELECT  @Query = 'SELECT * FROM DM_USER WHERE 1=0' +
            (
                SELECT  '
     OR Description LIKE ' + QUOTENAME('%' + Name + '%', '''')
                FROM    #User
                FOR XML PATH (''), TYPE
            ).value('.', 'nvarchar(max)')
    
    PRINT   '@Query = ' + ISNULL(@Query, 'NULL')
    EXEC    sp_executesql @Query
    

    Result:

    @Query = SELECT * FROM DM_USER WHERE 1=0
     OR Description LIKE '%First%'
     OR Description LIKE '%Second%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a query on SQL server to get the list of
I'm trying to write the following LINQ-Entities query: Get a list of Questions, that
I need to write a SQL query which will get me those rows from
I need to write a query that returns all object less that or equal
I need to write a query that will go through a table, find duplicate
I need a query for SQL Server 2000 to get a list of all
I need to write a WordPress query to accomplish the following - I am
I need to write the following query so the att field is always a
I have a table of products, and I need to write an SQL query
I need to write what I'd like to call a Valley Girl-query. I need

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.