Using Wild Character _ [modified]
-
Hi, I have a following file names in my database. TestDocument _ 1 _ 0 TestDocument _ Evidence Test45 123_publish when i am entering the Test_ in the DocumentName textbox it is forst converted to uppercase and send to the query and query has following expression which returns all record where it should not have to return any record. please tell me the changes in the following expression. UPPER(DOC.ORIGINAL_FILE_NAME) like '%TEST_%' Thanks, Umesh Tayade .
modified on Tuesday, May 24, 2011 6:32 AM
-
Hi, I have a following file names in my database. TestDocument _ 1 _ 0 TestDocument _ Evidence Test45 123_publish when i am entering the Test_ in the DocumentName textbox it is forst converted to uppercase and send to the query and query has following expression which returns all record where it should not have to return any record. please tell me the changes in the following expression. UPPER(DOC.ORIGINAL_FILE_NAME) like '%TEST_%' Thanks, Umesh Tayade .
modified on Tuesday, May 24, 2011 6:32 AM
This looks like a database question, not a C# issue. And wildcard operations aren't the same for all databases, so you'll have to specify what it is you are using. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
Hi, I have a following file names in my database. TestDocument _ 1 _ 0 TestDocument _ Evidence Test45 123_publish when i am entering the Test_ in the DocumentName textbox it is forst converted to uppercase and send to the query and query has following expression which returns all record where it should not have to return any record. please tell me the changes in the following expression. UPPER(DOC.ORIGINAL_FILE_NAME) like '%TEST_%' Thanks, Umesh Tayade .
modified on Tuesday, May 24, 2011 6:32 AM
Seriously, you can't see the issue. Take a look at your file names and point out the name that starts with
'TEST_'
. I see TestDocument and Test45 no Test_Never underestimate the power of human stupidity RAH
-
Hi, I have a following file names in my database. TestDocument _ 1 _ 0 TestDocument _ Evidence Test45 123_publish when i am entering the Test_ in the DocumentName textbox it is forst converted to uppercase and send to the query and query has following expression which returns all record where it should not have to return any record. please tell me the changes in the following expression. UPPER(DOC.ORIGINAL_FILE_NAME) like '%TEST_%' Thanks, Umesh Tayade .
modified on Tuesday, May 24, 2011 6:32 AM
Are you aware that, in Sql Server at least, the underscore character (_) is the wildcard for a single character? Very nasty in my opinion. You may wish to specify a different character in your query.
-
Seriously, you can't see the issue. Take a look at your file names and point out the name that starts with
'TEST_'
. I see TestDocument and Test45 no Test_Never underestimate the power of human stupidity RAH
Hi, I know that there is no document with the name TEST in my database but what i am telling is that when i search for TEST_ it should not have to return any records. but it is returning the records. Thanks, Umesh Tayade Never Underestimate the power of Human Stupidity
-
This looks like a database question, not a C# issue. And wildcard operations aren't the same for all databases, so you'll have to specify what it is you are using. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
Hi, I am using Oracle10g database. Thanks, Umesh Tayade
-
Hi, I know that there is no document with the name TEST in my database but what i am telling is that when i search for TEST_ it should not have to return any records. but it is returning the records. Thanks, Umesh Tayade Never Underestimate the power of Human Stupidity
It is returning records because you have two sets of wildcards in the query. In other words, you have the % and the _ characters. Effectively, your query is %TEST%.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Hi, I know that there is no document with the name TEST in my database but what i am telling is that when i search for TEST_ it should not have to return any records. but it is returning the records. Thanks, Umesh Tayade Never Underestimate the power of Human Stupidity
If you want to use the _ as a valid identifier in your query rather than having it act as a wildcard, you should precede it with a
\
, so your query would become%TEST\_%
.Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Hi, I am using Oracle10g database. Thanks, Umesh Tayade
Oracle wi_dcards[^]. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Tuesday, May 24, 2011 7:21 AM
-
Oracle wi_dcards[^]. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Tuesday, May 24, 2011 7:21 AM
Windcards? Where did the OP mention chronic flatulence?
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Windcards? Where did the OP mention chronic flatulence?
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
Sorry. I meant windcharts of course. Fixed it. Thanks. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.