Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using macros to Define User Defined DAta Types.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-03 : 08:46:28
Raj writes "I would like to define a variable in my stored procedure like

varName myDataType,


here, I would like myDataType to be a datatype that replaces the same as a Table Column.

In oracle we use to declare a variable like

varName tableName.colName%TYPE;

That will supply the table column's data type to my local variable. Is there anyway in MS SQL Server to do so. Any answer at the earliest would be greatly appeciated.

Thanks

Raj"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-06-03 : 09:07:42
Dynamic SQL will do the trick:

http://www.sqlteam.com/item.asp?ItemID=4599
http://www.sqlteam.com/item.asp?ItemID=4619

Go to Top of Page
   

- Advertisement -