output parameters

  • I have a problem with text data type as a output parameter in stored procedures.Which data type can not be output parameters?

    Thanks,

    Jelena

  • from BOL:

    data_type

    Is the parameter data type. All data types, including text, ntext and image, can be used as a parameter for a stored procedure. However, the cursor data type can be used only on OUTPUT parameters. When you specify a data type of cursor, the VARYING and OUTPUT keywords must also be specified. For more information about SQL Server - supplied data types and their syntax, see Data Types.

    Steve Jones

    steve@dkranch.net

  • Why is this not working?

    CREATE PROCEDURE dbo.sp_obj_Table1SelectBase

    @column1 nchar(10) = Null,

    @column2 int = Null,

    @column4 text(16) OUTPUT

    AS

    SELECT

    @column4 = o.column4

    FROM

    [dbo].[Table1] AS o

    WHERE

    (@column1 IS Null OR o.[column1] = @column1)

    AND (@column2 IS Null OR o.[column2] = @column2)

    RETURN 0

    GO

    column4 is defined in a table1 as text data type.

    Query Analyzer returns a message 'Parameter @column4 has an invalid data type.

  • Just remove the (16) - text is all you need for SQL to know what you mean, all text cols are treated the same regardless of size (more or less).

    Andy

Viewing 4 posts - 1 through 3 (of 3 total)

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