Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    2

    Unanswered: QueryAnalyzer issues

    I am calling a stored procedure from an ASP .Net page. It fails for some reason. I am trying to debug my stored procedure using QueryAnalyzer.

    Here is my stored procedure:

    CREATE PROCEDURE RESERVE_WIRES (
    @StartNum as int,
    @NumToReserve as int,
    @DateModified as datetime,
    @User as char(20))
    AS
    DECLARE @Counter as int
    DECLARE @WireNum as int
    WHILE @Counter < @NumToReserve
    BEGIN
    SELECT @Counter = @Counter + 1
    SELECT @WireNum = @StartNum + @Counter
    INSERT INTO TBL_WIRES (WireNumber, DateModified, User)
    VALUES (@WireNum, @DateModified, @User)
    END
    GO

    When I try to debug I get the follwing error:

    [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification

    Can anyone help with either the debugging or determining if my stored procedure is correct.

    Thanks in advance.
    Last edited by packfan4ever; 09-18-03 at 12:35.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    What datatype is column TBL_WIRES.User?
    What values are you submitting as @User?

    blindman

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    You may have to initialize the variable @counter. It should start off as null, and never recovers as SQL Server assigns null to "null + 1". Hope this helps.

  4. #4
    Join Date
    Sep 2003
    Posts
    2
    Thanks MCrowley

    I added the following line before my WHILE statement:

    SELECT @Counter = 0

    Works like a charm.

    Big help. Thanks again.

Posting Permissions

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