Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
t-sql 2008 r2 pass paramters
t-sql 2008 r2 pass paramters
Rate Topic
Display Mode
Topic Options
Author
Message
wendy elizabeth
wendy elizabeth
Posted Sunday, January 06, 2013 3:49 PM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Wednesday, February 13, 2013 7:58 AM
Points: 137,
Visits: 159
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?
Post #1403367
CELKO
CELKO
Posted Sunday, January 06, 2013 3:55 PM
SSCommitted
Group: General Forum Members
Last Login: Tuesday, January 15, 2013 11:11 AM
Points: 1,945,
Visits: 2,782
Thus my question is how would you write the queries to obtain the values I can referring to?
Do some data scrubbing in the front end
before
you pass values to the stored procedure. It is not worth it to guess all possible screw ups in the query; make the input layers do their job.
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Post #1403368
dwain.c
dwain.c
Posted Sunday, January 06, 2013 5:24 PM
SSCrazy
Group: General Forum Members
Last Login: Today @ 7:50 AM
Points: 2,368,
Visits: 3,245
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
No loops! No CURSORs! No RBAR! Hoo-uh!
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?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Are you too recursively challenged?
Splitting strings based on patterns can be fast!
Post #1403379
Grant Fritchey
Grant Fritchey
Posted Monday, January 07, 2013 4:43 AM
SSChampion
Group: General Forum Members
Last Login: Today @ 9:49 AM
Points: 13,436,
Visits: 25,281
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 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #1403540
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.