SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


t-sql 2008 r2 pass paramters


t-sql 2008 r2 pass paramters

Author
Message
wendy elizabeth
wendy elizabeth
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1210 Visits: 767
In need to pass 5 parameters to a stored procedure in sql server 2008 r2 standard edition database. The 5 parameters come from a filename in a Visual Basic.Net 2010/2012 application. Two of the parameters are ok since they are numeric values however 3 of the parameters are character that translates to varchar values.
My problem is the fields that are: 1. major product name, 2. sub product name, and 3. customer name may not be the exact values that are actually contained within the database. There may be differences in the values like upper versus lower case, the number of spaces that are entered between words, words like incorporated may have the abbreviation, and other any special circumstances.

Between the 4 of the 5 parameters that are to be supplied to the stored procdure, I obtain distinct (unique) values for rows in the database.

The only thing I think I can do is to look of names in character fields for the minimum size value contained in those columns. Thus my question is how would you write the queries to obtain the values I can referring to?
dwain.c
dwain.c
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: General Forum Members
Points: 7193 Visits: 6431
I tend to agree with Joe on this. Scrub the data in your front end application.

Given that, at this point in time, you've probably already collected lots of garbage that you can't go back and correct for whatever reason, it would be possible to do some scrubbing on your search.

However, you really need to provide us some DDL and samples of the data (in consumable form), so that we can cobble together some code to address those cases.

Refer to this article on how to do that: Forum Etiquette: How to post data/code on a forum to get the best help


My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
My temporal SQL musings: Calendar Tables, an Easter SQL, Time Slots and Self-maintaining, Contiguous Effective Dates in Temporal Tables
Grant Fritchey
Grant Fritchey
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39067 Visits: 32616
I'm with Joe and Dwain.

You do have an option, but it's somewhat dangerous. SQL Server has a function called SOUNDEX that sounds out how a word would be spoken. This allows you to take two words, spelled differently that do mean the same thing and possibly get them to link together. However, it's a very inaccurate way to go about it. And, putting the function on the column would prevent index use. You could store a soundex value in a column and then compare parameters to that. But you're still going to hit the accuracy issue.

Go with Joe & Dwain's initial suggestion.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search