Alpha Video Training
Results 1 to 4 of 4

Thread: MS SQL Query Problem

  1. #1
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,879

    Default MS SQL Query Problem

    Why is the count from line 3 returning zero??

    Ashampoo_Snap_Tuesday, October 29, 2019_16h45m13s_009_.png
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

  2. #2
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON, Canada
    Posts
    1,665

    Default Re: MS SQL Query Problem

    That looks like it should work. Only thing that comes to mind is if the Plaintiff_Type has some extra character or space at the end?

    Try this

    SELECT COUNT(ID) AS Row_Count FROM dbo.Plaintiff_Types WHERE Plantiff_Type LIKE '%Appellant%'




    Edit: Not that it matters but you have Plantiff_Type rather than Plaintiff_Type. Doesn't affect your case .. just pointing that out.
    Last edited by iRadiate; 10-29-2019 at 08:25 PM. Reason: Edit
    Alpha Anywhere v12.4.6.1.5 Build 6315-5397 IIS v10.0 on Windows Server 2019 Std in Hyper-V

  3. #3
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,334

    Default Re: MS SQL Query Problem

    Are you sure the value is "Appellant"?
    Alpha Anywhere latest pre-release

  4. #4
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,879

    Default Re: MS SQL Query Problem

    Quote Originally Posted by iRadiate View Post
    That looks like it should work. Only thing that comes to mind is if the Plaintiff_Type has some extra character or space at the end?

    Try this

    SELECT COUNT(ID) AS Row_Count FROM dbo.Plaintiff_Types WHERE Plantiff_Type LIKE '%Appellant%'




    Edit: Not that it matters but you have Plantiff_Type rather than Plaintiff_Type. Doesn't affect your case .. just pointing that out.

    The field name is misspelled and to correct it and the rest of the app isn't worth the time.


    Turns out there seems to be an extra, and hidden, character on the end of each row. SELECT COUNT(ID) AS Row_Count FROM dbo.Plaintiff_Types WHERE Plantiff_Type like 'Appellant%' works. So I ran UPDATE dbo.Plaintiff_Types SET Plantiff_Type = RTRIM(Plantiff_Type). That still didn't fix the problem. The data in the table was imported from a flat file. If I edit the table directly and add a new row then the count works for that new row.

    There are only 65 imported rows so I manually went to each one deleting what looks like a space (but isn't) at the end of each row. Now the original query run as it should.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

Similar Threads

  1. Query problem
    By bobshipley@rmrelevator in forum Windows Desktop Applications
    Replies: 1
    Last Post: 01-31-2019, 02:41 PM
  2. Query Problem
    By Judith in forum Alpha Five Version 7
    Replies: 16
    Last Post: 04-16-2007, 12:52 PM
  3. query problem
    By gveneman in forum Alpha Five Version 7
    Replies: 6
    Last Post: 04-15-2006, 10:44 AM
  4. QUERY PROBLEM
    By randall wenks in forum Alpha Five Version 4
    Replies: 16
    Last Post: 01-23-2004, 07:41 AM
  5. QUERY PROBLEM
    By Nip Lewis in forum Alpha Five Version 4
    Replies: 4
    Last Post: 03-19-2003, 04:16 AM

Bookmarks

Posting Permissions

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