Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data-Type mapping in SQL server 2005

Is there a way to declare mapped data-types in SQL Server 2005, something like Oracle's %Type:

Declare a emp.sal%type where data-type of a will be same as sal field of emp table

or Declare a emp%rowtype where data-types of a will be same as each row of emp table.

I have googled it,but couldn't find it.

like image 605
Pavitar Avatar asked Sep 28 '26 04:09

Pavitar


1 Answers

The Oracle %TYPE attribute adapts code as table definitions change. If the column's type changes, the variable adapts to use the correct type during run time. This enables data independence without requiring to know the exact data types to be assigned for a variable or database column.

Microsoft SQL Server does NOT support and has no equivalent of Oracle %TYPE.

like image 168
Sid Avatar answered Sep 30 '26 13:09

Sid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!