Declare Variables of the Right Datatype and Size while Creating Stored Procedure

Declare Variables of the Right Datatype and Size while Creating Stored Procedure

To help declare variables of the right datatype and size while creating Stored Procedures, this stored procedure accepts the name of the table and returns the variable list with all necessary information.

 Create proc [email protected] varchar(50)ASSELECT '@' + RTRIM(C.Name) + ' ' + RTRIM(T.Name) +	  case  	when (C.xtype = 167 or C.xtype = 175) then '(' +rtrim(cast(C.Length as char)) + ')'	  		else ''	  End + ','				 from sysobjects O, SYSCOLUMNS C, SYSTYPES TWHERE 	C.ID =  O.IdAND 	O.name = @NameAND	C.xtype = T.xtypeOrder by ColID--------------------------Result :[email protected] int,@FirstName varchar(50),@LastName varchar(50),@DOJ smalldatetime,@SpecialUser bit,
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular