Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Posts
    1

    Unanswered: UpperCase SQL Query Returning Error - Invalid Procedure Call

    Hi,

    I am currently working on a project involving ASP.NET and an Access Database. One of the queries that I need to do is to Search through a table and only grab the records that start with a capitol letter. Since I started creating the table dynamically with ASP.NET I've encountered this error ("Invalid Procedure Call") everytime that I try my SQL statement, when I use the table that was used to test the query works fine. I have double checked every parameter in the database concerning this one field and on both tables appear to be exactly the same. The following is a shortened version of the SQL that I'm trying to use.

    Code:
    SELECT surname FROM Tenants WHERE (asc(left(surname,1)) between 65 And 90);
    Any help with this would be very much appreciated.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    There is nothing wrong with the SQL (except it will result in another error if surname is NULL) so the problem is likely with the query you have abstracted.

    Can you confirm that the exact SQL you have posted results in the same exact error?

  3. #3
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    Question Coalesce

    Quote Originally Posted by pootle flump View Post
    There is nothing wrong with the SQL (except it will result in another error if surname is NULL) so the problem is likely with the query you have abstracted.

    Can you confirm that the exact SQL you have posted results in the same exact error?
    Maybe use COALESCE to handle null values in the surname;

    COALESCE(surname,'Unknown') which will return the first non-null value (If surname is null, it will return 'Unknown').
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

Posting Permissions

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