SQL Server AutoComplete Parameters

(3 posts) (2 voices)
  1. jcummins, Member

    Hello,

    First time poster here. I am using Microsoft SQL Server 2008 R2 and myDBR version 3.7.0 (build 1728). I have an autocomplete stored procedure that looks like this:

    IF object_id('sp_Autoc_DBR_CompanyName','P') IS NOT NULL
    DROP PROCEDURE [sp_Autoc_DBR_CompanyName]
    GO create procedure sp_Autoc_DBR_CompanyName @inTitle varchar(255)
    AS
    begin select c.Company_Name as 'Company_Name' from db..CompanyTable c
    WHERE c.Company_Name like @inTitle+'%';
    end

    The parameter is type Autocomplete and the value of the query is as follows:

    exec sp_Autoc_DBR_CompanyName 'My'

    When I try to run my report I get the following error:

    DB error Procedure or function sp_Autoc_DBR_CompanyName has too many arguments specified.
    SQL: exec sp_Autoc_DBR_CompanyName 'My','MYDBR_COL_COUNT_READ'

    The strange bit is this. If I open a new blank query window and execute the following command I actually get the proper results (a list of companies starting with the letters My):

    exec sp_Autoc_DBR_CompanyName 'My'

    I've had this working on a MySQL install of MyDBR but this is the first time I've tried it on MSSQL.

    Any ideas?

    Jim

  2. myDBR Team, Key Master

    When you set the autocomplete query, simply state the procedure name (sp_Autoc_DBR_CompanyName) and nothing else. myDBR will take the user input and pass it as a parameter to the autocomplete procedure.

    The MYDBR_COL_COUNT_READ is a myDBR's internal query to the procedure so it can determine how many columns will the autocomplete query return.

    --
    myDBR Team

  3. jcummins, Member

    Fantastic! This worked wonders.


Reply

You must log in to post.