Syntax question

  • Hi all,

    Does this syntax look correct?

    SELECT [JS20040408].[ID], [JS20040408].[Role Type], [JS20040408].[Field2], [JS20040408].[Field3], [JS20040408].[Field4], [JS20040408].[Field5], [JS20040408].[Field6], [JS20040408].[Field7], [JS20040408].[Field8], [JS20040408].[Field9], [JS20040408].[Field10], [JS20040408].[Field11], [JS20040408].[Field12], [JS20040408].[Field13], [JS20040408].[Field14], [JS20040408].[Field15]

    FROM JS20040408

    WHERE field2 like '%xxxx%';

    I'm trying to find all cells containing the value 'xxxx', including those with values other in addition to xxxx.

    Trouble is, the above code doesn't return any rows, but I SEE the values in the table.  Have I made a mistake in the syntax, somewhere?

    Thanks in advance,

    KS

  • After reformatting your query to make it easier to read, it looks fine to me.

    SELECT

      js.ID

    , js.[Role Type]

    , js.Field2

    , js.Field3

    , js.Field4

    , js.Field5

    , js.Field6

    , js.Field7

    , js.Field8

    , js.Field9

    , js.Field10

    , js.Field11

    , js.Field12

    , js.Field13

    , js.Field14

    , js.Field15

    FROM JS20040408 js

    WHERE js.field2 like '%xxxx%';

    Does your query return data if you drop the Where clause?  I added the "js." in the Where clause, but I think it's not necessary.  Also, you might want to change the '%xxxx%' to '%XXXX%' in case your server is setup to catch case sensitivity.

    Butch


    Butch

  • Cheers Butch (Pulp Fiction fan, I presume?)

    I dropped the 'where' clause, and it returns the entire table - as it should.

    Any idea how to case-desensitize Access?  This is a personal project, not a corporate one.

    Cheers,

    KS.

  • KS,

    It'll likely slow down your query, but try comparing UCase() = UCase (). That way you know that both are being compared equally.

    It's ugly, but ...

    Jeff

  • The wildcard character in Access is '*' and not '%' like SQL Server or Oracle.  See if this helps.

    Pete

  • Pete is absolutely correct... I thought I was dealing with SQL!


    Butch

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply