tsql - SQL Server sync size of variable used in stored procedures or functions -
we create variables store column data, below
declare @name varchar(300) select @name = name, @age = age [employee]
here, give size varchar(300)
in assumption length defined in table 300
.
and happens across store procedures.
what if size increased in table ? (eg. 500). there easy way update size across stored procedures ? or better way of creating variables ?
i believe want oracle %type
:
the oracle %type attribute adapts code table definitions change. %type attribute provides datatype of variable or database column. if column's type changes, variable uses correct type @ run time. provides data independence , reduces maintenance costs.
microsoft sql server not support , has no equivalent of oracle %type.
sql server not suppport mechanism. possible solutions:
- declare variables length more 300
- use user-defined datatypes
Comments
Post a Comment