• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

How to filter in a Stored Procedure specific records.

I need to get rido of some of the records through the Stored Procedure before they even hit the report. They are in the top of the list and at the very bottom. I need to remove 000000 and the INV , R13 , ZRW. Anything that starts with a 4 can stay. All others need to go.

Is there a simple way to only show those values that start with a "4" on the field.

The records come from two different databases. One field Prod_cat and another comes from Prd_gltype and they are dumped into a temp table and then reported on in Crystal Reports. I do not know if that matters.
  • 2
2 Solutions
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>Is there a simple way to only show those values that start with a "4" on the field.
Copy-paste the Stored Procedure's T-SQL into this question.
Ultimately it'll be a WHERE clause that goes something like this..

WHERE LEFT(group_code, 1) = '4'

Also, let us know if this is a permanent filter, or user-selectable.
If you are not able to alter the existing stored procedure due to business reasons, create a wrapper stored procedure, call actual stored procedure from within your wrapper stored procedure and store the results into some temp table then select all records from temp table except ones that you don't want.
ruavol2Tableau Trainer & Consultant Sales Exec.Author Commented:
It is a permanent filter. User will not select this one.
ruavol2Tableau Trainer & Consultant Sales Exec.Author Commented:
That got it thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now