Text Data Type & Stored procedure

  • All,

    I have some problme with handling Text datatype in a SP.

    My Code:

    create proc M_Insert(@START_TIME datetime,@END_TIME varchar(100),@ERROR_MSG text)

    as

    Begin

    insert into LOG_TABLE(@START_TIME,@END_TIME,@ERROR_MSG)

    End

    I got the below error message.

    TEXT and IMAGE datatypes are invalid for parameters or local variables.

    Inputs are highly appreciable !

    karthik

  • Are you sure it's T-SQL script?

    You need to learn the syntax of CREATE PROCEDURE and INSERT INTO statements.

    I would suggest using BOL or any other book about essential T-SQL.

    _____________
    Code for TallyGenerator

  • Sergiy,

    I may be wrong because of my urgent need. I hope you can understand my code now.

    create procedure Message_Insert

    (

    @START_TIME datetime,

    @END_TIME varchar(100),

    @ERROR_MSG text

    )

    as

    Begin

    Insert into LOG_TABLE (START_TIME,END_TIME,ERROR_MSG)

    Values(@START_TIME,@END_TIME,@ERROR_MSG)

    End

    karthik

  • I hope your SQL Server can now understand your code as well.

    At least mine can.

    _____________
    Code for TallyGenerator

  • Ok.

    Can you tell me what could be the reason for the error message ?

    karthik

  • karthikeyan (6/10/2008)


    Ok.

    Can you tell me what could be the reason for the error message ?

    Which error message?

    I don't get any one.

    _____________
    Code for TallyGenerator

  • I got the below error message.

    TEXT and IMAGE datatypes are invalid for parameters or local variables.

    Inputs are highly appreciable !

    karthik

  • Once again, last version of the script you posted works fine without errors.

    This is my test script:

    CREATE TABLE LOG_TABLE

    (

    START_TIME datetime,

    END_TIME varchar(100),

    ERROR_MSG text

    )

    GO

    create procedure Message_Insert

    (

    @START_TIME datetime,

    @END_TIME varchar(100),

    @ERROR_MSG text

    )

    as

    Begin

    Insert into LOG_TABLE (START_TIME,END_TIME,ERROR_MSG)

    Values(@START_TIME,@END_TIME,@ERROR_MSG)

    End

    GO

    EXEC Message_Insert @START_TIME = '20080611', @END_TIME = '1:01:00', @ERROR_MSG = 'Error'

    GO

    SELECT * FROM LOG_TABLE

    GO

    DROP procedure Message_Insert

    DROP TABLE LOG_TABLE

    Are you sure you're on SQL2000?

    _____________
    Code for TallyGenerator

  • Yes, I am using 2000 only.

    I will check it and come back to you.

    Thanks a lot for your prompt reply.

    karthik

  • hi did u get the answer for the same ?

    i am able to create a sp with data type text but when i run it on server calling it from asp it fails

    any reason or any typical way of handling text data type while parsing it to sql server?

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply