Results 1 to 3 of 3

Thread: Using Like SQL Command with numerec field type in Crystal Report(Resolved)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142

    Using Like SQL Command with numerec field type in Crystal Report(Resolved)

    Hi
    I am using the following SQL command to retrieve all the items records start with item number # 6 for the field ITEM NUMBER, the result is OK:
    Code:
    SELECT * FROM LIST_ITEMS WHERE LIST_ITEMS.[ITEM NUMBER]
    Like '*6*' AND LIST_ITEMS.[ITEM Description] Like '**' ORDER BY
    LIST_ITEMS.[ITEM NUMBER];
    But when I use the following SQL for retrieving the same result in Crystal report, It does not work, like command seems will not work with numerical field type, it only accepts the equal sign:
    Code:
    {LIST_ITEMS.ITEM NUMBER} Like '*6*' And {LIST_ITEMS.ITEM
    Description} Like "*"
    Am I missing any parameters in the above code, appreciate your help
    Last edited by maqmaq; Sep 22nd, 2003 at 01:26 PM.
    On error goto vbforums.com

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    This might help
    VB Code:
    1. cast {LIST_ITEMS.ITEM NUMBER} as char Like '*6*' And {LIST_ITEMS.ITEM
    2. Description} Like "*"
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142
    Thanks for your lights, I have posted this question in [email protected] and get semilar answer, I liked to posted here for reference:
    Appreciate your reply.
    ------------
    Mark
    Thank you very much, I tried what you had suggested
    and it works exactly as I need.

    CStr({LIST_ITEMS.ITEM NUMBER}) Like '*6*' And
    {PUNCH_LIST_ITEMS.ITEM Description} Like "*"

    I even used the * and stil it is working.

    Many Many Thanks to you and to others who participated
    in this question.

    --- maqmaq> wrote:
    Mark
    Thank you very much, I tried what you had suggested
    and it works exactly as I need.

    CStr({LIST_ITEMS.ITEM NUMBER}) Like '*6*' And
    {PUNCH_LIST_ITEMS.ITEM Description} Like "*"

    I even used the * and stil it is working.

    Many Many Thanks to you and to others who participated
    in this question.




    --- maqmaq> wrote:
    eg: from fields
    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17...
    you want to return just records 6 and 16 ?

    That is correct...exactly what I am loking for.
    I keep trying and hopefully end with success.
    Appreciate your continous help


    --- mark_the_starwatcher
    <[email protected]> wrote:

    Whoa... this seems weird.

    If I understand you, you've got a numeric field
    and
    want to select
    records based on the number having a "6" digit
    anywhere in the field?

    eg: from fields
    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17...

    you want to return just records 6 and 16 ?

    If that's the case, you'll need to convert the
    numeric field to a
    string, and then use LIKE on the coverted string.
    I don't think LIKE
    will work on numerics.

    Checkout the convert function in SQL Books on
    Line.

    Must say, if my understanding is correct, seems
    like a very strange requirement.

    > > Cheers,
    > >
    > > Mark
    On error goto vbforums.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width