Reputation: 47
I have a table Customer
which has 3 columns
CCode varchar(100),
CName varchar(200),
Address varchar(500)
I want to create a procedure to insert data, I want that datatype of parameter should be selected automatically according to the table columns, so that for example if i need to change the CCode
datatype from varchar to int in the table, it should be automatically change the datatype of parameter CCode
.
Like oracle provide % type attribute, as you can see in below link:
https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/type_attribute.htm
I want same functionality as mentioned in above link.
Upvotes: 0
Views: 932
Reputation: 15849
SQL Server doesn't support the %TYPE functionality that Oracle has. You could use sql_variant
, but that has drawbacks around knowing what type it's supposed to be. You could also try having a variety of optional parameters, and then using whichever is actually going to be used in your situation.
Upvotes: 1