%TYPE in T-SQL???

  • Hi there,

    I am currently maintaining tons of T-SQL (more than 400) sps. Is there any way I could reference a local variable like in Oracle %TYPE? It is a very handy way for maintenance and you don't have to worry about updaing variables if ever a datatype changed in a table which you have declared a local variable based on that table column. Anyway idea what I am talking about and any suggestion for this particular problem?

    AC

  • I'm certainly no Oracle expert, but from your explanation, I think a user defined datatype is the solution.

    If you use a user-defined datatype consistently throughout your database (in table definitions, stored procedures, triggers and so on), any change in a type is automatically applied to all occurrences.

    Come to think of it, don't know if you need to manually recompile any stored procedures after a change. Anyone ... ?

  • Thanks for your reply NPeeters. I have been experienced for a table column resized, I had to search and update for all the sps in which I have local variables declare based on the rezied column. What's pain you can imagine! I know there is a user-defined datatype but have ever create something like this, any example provided?

    AC

  • I got it. It's cool! Even though it is not as convenience as in Oracle, it is definitely better than search for all of my sps and update each of them.

    AC

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply