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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:37:05+00:00 2026-06-14T09:37:05+00:00

My stored procedure accepts a parameter with values like Declare @Temp VarChar(Max) Set @Temp

  • 0

My stored procedure accepts a parameter with values like

Declare @Temp VarChar(Max)
Set @Temp = 'S1CW3733|1050105000224,S1CW4923|1050105000009'

Where values is like

Column1|Column2,Column1|Column2,Column1|Column2,

I want to apply same in SQL query like

Select * 
From ATMStatus 
Where ATM + '|' + Fault IN (@Temp)

How can I achieve this?

Database is SQL Server 2008

  • 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-14T09:37:06+00:00Added an answer on June 14, 2026 at 9:37 am

    For small tables, you can use the table scanning solution, assuming ATM and Fault can never contain comma (,) or pipe (|):

    Select *
      From ATMStatus
     Where ',' + @Temp + ',' LIKE '%,' + ATM + '|' + Fault + ',%';
    

    For large tables, you’ll need to employ a splitting function to turn the variable into a multi-row, 2 column table, which would then be used something like:

    Select a.*
      From ATMStatus a
      join dbo.SplitVarTo2ColumnTable(@Temp) b
           on b.Column1 = a.ATM and b.Column2 = a.Fault;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The first parameter of my stored procedure, usp_LogMessage_Begin, accepts a varchar field as the
I'm trying to call a stored procedure that accepts a table value parameter. I
I have a stored procedure that accepts a date input that is later set
I have a Firebird stored procedure that accepts Decimal(9,6) values for Latitude and Longitude
I have a stored procedure that accepts an xml parameter (SqlDbType.Xml) that is being
In SQL Server, I have a stored procedure that accepts a date parameter. That
I have created a stored procedure that accepts 3 parameters. @row int ,@column VARCHAR(17)
I am using Sql Server 2008. My Stored Procedure accepts almost 150 parameters. Is
I want to write a stored procedure that will accept a parameter of @searchString.
I have a stored procedure which accepts a User defined table type called SeasonTable

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.