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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:35:18+00:00 2026-06-13T08:35:18+00:00

The following code is supposed to take a string that may or may not

  • 0

The following code is supposed to take a string that may or may not be comma delimited and put it into a table (#tmpFullanme) that part works flawlessly. The second part is supposed return all the values that are LIKE / NOT LIKE with or without % symbols based on what is input. The error that I am getting is “the multi-part identifier “#tmpFullname.Item” could not be bound.” The best guess I have is that it may be out of scope?

DROP PROCEDURE uspJudgments; 
GO 
CREATE PROCEDURE uspJudgments 
@fullName varchar(100), @SrchCriteria1 varchar(15), @SrchCriteria2 varchar(15), @qualifier varchar(10) 
AS 
BEGIN 

SELECT * 
INTO #tmpFullname 
FROM dbo.DelimitedSplit8K(@fullName, ',') 

DECLARE @Query NVarChar(1024) 
SET @Query = 'SELECT d.*' + ' FROM defendants_ALL d, #tmpFullname' + 
' WHERE d.combined_name' + ' ' + @qualifier + ' ' + '''' + @SrchCriteria1 + '''' + ' + ' + '''' + #tmpFullname.Item + '''' + ' + ' + '''' + @SrchCriteria2 + '''' 

END 

EXEC sp_executesql @Query 
PRINT(@Query) 

IF OBJECT_ID('#tmpFullname', 'U') IS NOT NULL 
DROP TABLE #tmpFullname 

EXEC uspJudgments @qualifier = 'LIKE', @fullName = 'johnson', @SrchCriteria1 = '%', @SrchCriteria2 = '%'

Cannot get to the PRINT output as “the multi-part identifier “#tmpFullname.Item” could not be bound.” If I change #tmpFullname.Item to ‘#tmpFullname.Item it goes through and returns nothing but it shows that the query is correct minus the issue with that table.

SELECT d.* FROM defendants_ALL d, #tmpFullname WHERE d.combined_name LIKE '%' + '#tmpFullname.Item' + '%'

Please note that until I made this into a dynamic query so I can change the statement from LIKE to IN etc it worked very well.

  • 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-13T08:35:19+00:00Added an answer on June 13, 2026 at 8:35 am

    I set up a full test to get the proper script to get you your desired results. I also have a SQL Fiddle showing how this works. Note You will want to run EXECUTE sp_executesql @Query inside the stored procedure

    ALTER PROCEDURE uspJudgments @fullName varchar(100)
       , @SrchCriteria1 varchar(15)
       , @SrchCriteria2 varchar(15)
       , @qualifier varchar(10) 
    AS 
    BEGIN 
    
       --Simulates your split function
       SELECT *
       INTO #tmpFullName
       FROM
       (
         SELECT 'firstTest' AS Item
         UNION ALL SELECT 'secondTest'
         UNION ALL SELECT 'NotThere'
       ) AS t;
    
       DECLARE @Query NVARCHAR(1024);
       SELECT @Query = 'SELECT d.* '
          + ' FROM defendants_ALL d '
          + ' CROSS JOIN #tmpFullName AS t '
          + ' WHERE d.combined_name' + ' ' + @qualifier + ' '
          + '''' + @SrchCriteria1 + ''''
          + ' + ' + 't.Item' + ' + ' + '''' + @SrchCriteria2 + '''';
    
       EXECUTE sp_executesql @Query;
    
    END
    
    EXECUTE uspJudgments
    @fullName = 'does not matter'
       , @SrchCriteria1 = '%'
       , @SrchCriteria2 = '%'
       , @qualifier = 'LIKE';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code is supposed to find electors that do not have a postal
I have the following code thats supposed to take the input entered into a
the following lines of code are supposed to take whatever i type in and
The following code is supposed to make the right 60% of the display red.
I am creating a SMS app the following code is supposed to: check if
Given the following code (it's supposed to write helloworld in a helloworld file, and
The following code is suppose to be doing this : - Displaying a string
Suppose I have the following code: foreach(string str in someObj.GetMyStrings()) { // do some
I am using the following code to take a screenshot of a TableLayout. I
I have the following code which does (the first part of) what I want

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.