Parameter datatypes linked to underlying table column datatype

  • Hi,

    In Oracle when i create any procedure i define parameter datatype linked to under lying table.

    For ex

    create procedure testprocedure

    (param1 customer.name%type,

    param2 customer.salary%type )

    Here i have defined param1 and param2 with datatype of name and salary of customer table respectively.

    This way i do not need to worry about modifying param1 and param2 datatypes when datatypes of name & salary of customer table changes in future.

    How can i accomplish this in SQL server.

    I appreciate your response.

  • Lookup the data types of the underlying columns and then manually set them. That's the only way.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Sadly, you can't do that directly in SQL Server.

    The only way to simulate that would be to use alias data types -- lots of aliases.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

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