T-SQL's equivalent of Oracle's %TYPE operator?

﹥>﹥吖頭↗ 提交于 2019-12-09 17:02:59

问题


When writing a procedure in PL/SQL, I can declare a parameter's type as myTable.myColumn%TYPE so that when I alter myColumn's type from say varchar2(20) to varchar2(50) I don't have to change the procedure's parameter type. Is there something similar in T-SQL?


回答1:


No, there is no equivalent in T-SQL.




回答2:


The best that you could do would be to create a user-defined data type, then you could change the underlying UDT and it would take effect in both places.

This would affect it everywhere that you use it, so if you used the type in multiple tables it would affect them all if you changed it.



来源:https://stackoverflow.com/questions/1849396/t-sqls-equivalent-of-oracles-type-operator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!