Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BCP & like 'AA%' does not work

272 views
Skip to first unread message

Jim Hsu

unread,
Oct 10, 2003, 1:02:30 PM10/10/03
to
when I use BCP
the following works for me
'bcp "select * from adcumh.dbo.mcmsgmetadata where MsgName between 'CBFX'
and 'CBFXZZ'" queryout mcmsgmetadata2.txt -c -T'

why I don't use like 'CBFX%'?
cause it won't work

any suggestion?

Jim


Kalen Delaney

unread,
Oct 10, 2003, 1:41:25 PM10/10/03
to
Hi Jim

What does it mean that it won't work? Do you get an error message, or do you
get fewer or more rows than expected.
If you run this query in Query Analyzer does it give the expected results?
What is the case sensitivity of the SQL Server?

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Jim Hsu" <oric...@nospam.msa.hinet.net> wrote in message
news:#9VUOB1j...@TK2MSFTNGP12.phx.gbl...

Jim Hsu

unread,
Oct 12, 2003, 5:22:53 AM10/12/03
to
Kelen:
no errors but no rows returned either
8 rows returned while runing in isqlw.exe
they have the [msgname]
CBFxAmd
CBFXAMRQ
CBFxCan
CBFXCLRQ
CBFXINQ
CBFXIQRQ
CBFXSIRQ
CBFxStatusInq

suppose there are no CS/CI issues since I just change the BCP from like to
between, and I did that by minimize change my script.

I have attached the out put to you,
in case it help

thank you
-Jim

"Kalen Delaney" <replies@public_newsgroups.com> wrote in message
news:e4No8W1j...@tk2msftngp13.phx.gbl...

NameData.zip

Kalen Delaney

unread,
Oct 12, 2003, 11:26:01 AM10/12/03
to
Jim
I was not able to duplicate this problem. BCP queryout worked fine with a
LIKE and wildcard.
Please show me the exact bcp command you used with LIKE.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Jim Hsu" <oric...@nospam.msa.hinet.net> wrote in message

news:#IpaxJKk...@TK2MSFTNGP12.phx.gbl...

Kalen Delaney

unread,
Oct 12, 2003, 11:43:47 AM10/12/03
to
Also, there is no way I can run these scripts without the table definition.
Please suppy the CREATE TABLE information.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Jim Hsu" <oric...@nospam.msa.hinet.net> wrote in message

news:#IpaxJKk...@TK2MSFTNGP12.phx.gbl...

Kalen Delaney

unread,
Oct 12, 2003, 2:26:13 PM10/12/03
to
Jim

I had to adjust the earlier bcp in command to accomodate this new table name
and data file. Next time, please send all scripts needed to create the
table, populate it, and run your tests.

It looks like a % in a cmd file is ignored or treated as something else. If
I just type the command into a command window, it works fine. If I execute
your bcp1.cmd, it does not. A workaround I found was to use a double %% in
the bcp1.cmd file for the search string. I'll report this and see if it is a
known issue.


--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Jim Hsu" <oric...@nospam.msa.hinet.net> wrote in message

news:#8cJbIOk...@tk2msftngp13.phx.gbl...
> Kalen:
> Here you are,
> let me know if anything is missing;


> -Jim
>
> "Kalen Delaney" <replies@public_newsgroups.com> wrote in message

> news:Ot%236heNk...@TK2MSFTNGP10.phx.gbl...

Kalen Delaney

unread,
Oct 13, 2003, 10:50:45 AM10/13/03
to
Thanks to MVPs Linda Wierzbicki and John Bell, I realized that the % is used
to indicate a replaceable parameter. The workaround that I stumbled upon is
the documented one, to use two % to escape. John quoted the DOS 5.0 Users
Guide and Reference book on replaceable parameters:

"If you use the percent sign (%) as part of a filename or string within a
batch program, you must type it twice. The first occurence indicates that
the second % is part of a name rather than a replacable parameters."

However, this does not seem to be mentioned in the Windows 2000 (or XP)
help.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Jim Hsu" <oric...@nospam.msa.hinet.net> wrote in message

news:#8cJbIOk...@tk2msftngp13.phx.gbl...
> Kalen:
> Here you are,
> let me know if anything is missing;

> -Jim
>
> "Kalen Delaney" <replies@public_newsgroups.com> wrote in message

> news:Ot%236heNk...@TK2MSFTNGP10.phx.gbl...

Jim Hsu

unread,
Oct 13, 2003, 1:05:35 PM10/13/03
to
cool, guess this is a document issue,
thank you very much.

May you have a nice day :-)
Jim

"Kalen Delaney" <replies@public_newsgroups.com> wrote in message

news:OqNAklZk...@tk2msftngp13.phx.gbl...

0 new messages