473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Table.Select not work with '*' in middle of query...

VM
If I want to run this query ( " col_output like '<del> *BOX' " ), it'll
throw an exception. How can I search for any rows that begin with '<del>'
and end with 'BOX'?
Would it also be possible to retrieve any rows that begin with '*<del>' and
end with 'BOX*' (ie. "col_output like '*<del>*BOX*' " ) ?

Thanks.


Nov 16 '05 #1
8 2091

"VM" <vo******@yahoo.com> wrote in message
news:eV*************@TK2MSFTNGP12.phx.gbl...
If I want to run this query ( " col_output like '<del> *BOX' " ), it'll
throw an exception. How can I search for any rows that begin with '<del>'
and end with 'BOX'?
Would it also be possible to retrieve any rows that begin with '*<del>' and end with 'BOX*' (ie. "col_output like '*<del>*BOX*' " ) ?

Thanks.

I'm not entirely sure, but you might try using the percent symbol (%) in
place of the asterisks (*).

"col_output like '<del> %BOX' "
Rick Sawtell
Nov 16 '05 #2
VM
I tried that but it doesn't work either.

VM

"Rick Sawtell" <r_*******@hotmail.com> wrote in message
news:up*************@TK2MSFTNGP12.phx.gbl...

"VM" <vo******@yahoo.com> wrote in message
news:eV*************@TK2MSFTNGP12.phx.gbl...
If I want to run this query ( " col_output like '<del> *BOX' " ), it'll
throw an exception. How can I search for any rows that begin with '<del>' and end with 'BOX'?
Would it also be possible to retrieve any rows that begin with '*<del>'

and
end with 'BOX*' (ie. "col_output like '*<del>*BOX*' " ) ?

Thanks.

I'm not entirely sure, but you might try using the percent symbol (%) in
place of the asterisks (*).

"col_output like '<del> %BOX' "
Rick Sawtell

Nov 16 '05 #3
VM <vo******@yahoo.com> wrote:
If I want to run this query ( " col_output like '<del> *BOX' " ), it'll
throw an exception. How can I search for any rows that begin with '<del>'
and end with 'BOX'?


Have you tried:

col_output like '<del>*' AND col_output like '*BOX'

?

The reason your previous attempt didn't work is that, as the docs
state:

<quote>
Wildcards are not allowed in the middle of a string. For example,
'te*xt' is not allowed.
</quote>

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
VM
It wouldn't work because then it'd return this string:
<del> BELLEVUE STREET \r\n
<czz> BOXVILLE MA 10029-2293

The query must only return something like this:
<del> PO BOX 19930 \r\n
<czz> HOUSTON TX 10029-2293

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
VM <vo******@yahoo.com> wrote:
If I want to run this query ( " col_output like '<del> *BOX' " ), it'll
throw an exception. How can I search for any rows that begin with '<del>' and end with 'BOX'?


Have you tried:

col_output like '<del>*' AND col_output like '*BOX'

?

The reason your previous attempt didn't work is that, as the docs
state:

<quote>
Wildcards are not allowed in the middle of a string. For example,
'te*xt' is not allowed.
</quote>

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #5
VM <vo******@yahoo.com> wrote:
It wouldn't work because then it'd return this string:
<del> BELLEVUE STREET \r\n
<czz> BOXVILLE MA 10029-2293

The query must only return something like this:
<del> PO BOX 19930 \r\n
<czz> HOUSTON TX 10029-2293


Well the first would match '<del> *BOX' if you could do that anyway, as
the * would match "BELLEVUE STREET \r\n<czz> " wouldn't it?

What do you *really* want it to do?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
VM
In my table, I have two records and in col_output, the 2 string values are:

<del> BELLEVUE STREET
<csz> BOXVILLE MA 10029-2293
---and---

<del> PO BOX 19930 \r\n
<czz> HOUSTON TX 10029-2293

I want to retrieve the second record with only the string 'BOX' available
create the query. But you're right because '<del> * BOX*' would also bring
the first one.

I know there's a better way to store the data but for now the client wants
it like this.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
VM <vo******@yahoo.com> wrote:
It wouldn't work because then it'd return this string:
<del> BELLEVUE STREET \r\n
<czz> BOXVILLE MA 10029-2293

The query must only return something like this:
<del> PO BOX 19930 \r\n
<czz> HOUSTON TX 10029-2293


Well the first would match '<del> *BOX' if you could do that anyway, as
the * would match "BELLEVUE STREET \r\n<czz> " wouldn't it?

What do you *really* want it to do?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #7
VM <vo******@yahoo.com> wrote:
In my table, I have two records and in col_output, the 2 string values are:

<del> BELLEVUE STREET
<csz> BOXVILLE MA 10029-2293
---and---

<del> PO BOX 19930 \r\n
<czz> HOUSTON TX 10029-2293

I want to retrieve the second record with only the string 'BOX' available
create the query. But you're right because '<del> * BOX*' would also bring
the first one.


So what is it that makes the second different from the first for you?
Is it that BOX is on its own? Do you actually want <del> * BOX *? If
so, just do

foo LIKE '<del > * ' and foo LIKE '* BOX *'

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #8


If " col_output like '<del> *BOX' " is part a SQL string
Then you should use % for zero or more chars, use _ for single char.

Lishi Liu, VSData Team
--------------------
Reply-To: "VM" <vo******@yahoo.com>
From: "VM" <vo******@yahoo.com>
Subject: Table.Select not work with '*' in middle of query...
Date: Fri, 16 Jul 2004 12:26:12 -0400
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <eV*************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: cvx-ppp-66-50-127-98.coqui.net 66.50.127.98
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:259348
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

If I want to run this query ( " col_output like '<del> *BOX' " ), it'll
throw an exception. How can I search for any rows that begin with '<del>'
and end with 'BOX'?
Would it also be possible to retrieve any rows that begin with '*<del>' and
end with 'BOX*' (ie. "col_output like '*<del>*BOX*' " ) ?

Thanks.



Nov 16 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin Feuersteiner | last post by:
Hi I'm grateful for any light you can shed on this!! I've to admit, it's an unusual design but I've multiple contact tables named e.g. i2b_ash_contact or i2b_ted_contact. 'i2b_' and...
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
9
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with...
6
by: davegb | last post by:
I'm trying to create a self-join table to show the relationship between employee and supervisor. In another thread, I was advised to create a SupervisorID in the employee table, a separate...
6
by: Sam Johnson | last post by:
HI I tried to send the following SQL string to an open databse, to export a table into excel format: g.Connection = conn 'valid OleDBConnection and Command objects g.CommandText = "SELECT *...
20
by: Neil Robbins | last post by:
I am trying to execute a make table query in my vb.net program. The db that I am accessing is an Access 2000 format db. The SQL code that I am using has been cut and pasted from the SQL View having...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
22
by: Mal Ball | last post by:
I hope I have the right forum for this question. I have an existing Windows application which uses a SQL Server database and stored procedures. I am now developing a web application to use the same...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.