Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Parameter datatypes linked to underlying table column datatype Expand / Collapse
Posted Thursday, June 5, 2014 1:04 PM


Group: General Forum Members
Last Login: Thursday, July 23, 2015 9:30 AM
Points: 16, Visits: 86

In Oracle when i create any procedure i define parameter datatype linked to under lying table.
For ex
create procedure testprocedure
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.
Post #1578027
Posted Thursday, June 5, 2014 2:10 PM



Group: General Forum Members
Last Login: Today @ 4:16 PM
Points: 15,517, Visits: 29,725
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
The Scary DBA
Author of:
SQL Server Query Performance Tuning
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1578050
Posted Friday, June 6, 2014 3:22 PM


Group: General Forum Members
Last Login: Today @ 1:06 PM
Points: 2,939, Visits: 4,484
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)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1578531
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse