How can I add suffix for any dataType

  • I'd like return a constant value from storedProc/function which type is TinyInt

    How can I specify it without casting/converting by suffixing the number

    For ex.

    Return 1; <--- mean return 1 in type of INT

    Return Cast(1 as TinyInt) <---- mean return 1 in type of TinyInt

    Can I use below instead

    Return 1T <--- return 1 in type of TinyInt

  • It's not possible unfortunately.

    There's no such suffix to append to consider constants in a particular datatype (looks a lot like java...).

    Moreover, a stored procedure ALWAYS returns type int, so that a tinyint return value is automatically promoted to int.

    Regards,

    Gianluca

    -- Gianluca Sartori

  • I'd like return a constant value from storedProc/function which type isTinyInt

    If it's a function, then you explicitly declare the return type anyway.

    If it's a stored procedure, then you could always use an output parameter (for which you also explicitly delare the type) instead.

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

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