Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Select behaves not like Seek

Status
Not open for further replies.

mirkado227

Programmer
May 28, 2005
12
TR
Say we have a table created like
Code:
CREATE TABLE Cards (KartNr C(6) NOCPTRANS)

The index is created with:
Code:
SET COLLATE TO  "machine"
INDEX ON kartnr TAG kartnr_idx

KartNr contains binary informations. With the browse command there are displayed as garbage characters. To display them, I have to use e.g. ASC(SubStr(KartNr,1,1)) etc.

Now say:
- in variable cKartNr is a valid CardNumber
- and I try to find the specific record in table Cards

Code:
SELECT * FROM Cards Where KartNr == cKartNr
returns all records in Table Cards

But
Code:
=SEEK(cKartNr, "Cards", "KartNr_Idx")
finds the specific record.

With other words: I found a solution for my problem. But I does not understand the background of this problem. Can someone enlighten me?

Thanks in advance

 

You mean, you included STRCONV() in the INDEX exression, and SEEK, too, and it works?
Thanks for confirming. Glad it works.
 
@Stella740pl
Sorry for my delayed answer.
I changed all my SQL queries to
Code:
SELECT * FROM Cards Where STRCONV(KartNr,15) == STRCONV(cKartNr,15)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top