Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In oracle we can let the datatype of the stored procedure parameter map to the datatype of the columns example
SQL
CREATE PROCEDURE [CheckCustomer]
@customerid onl_Customers.UserID%type


Can we do that in sql


stored procedure parameter data type automatically gets the column datatypeQuestion:
Is there a way so that in a stored procedure instead of assigning the data type of the parameter I can pull it from the columndata type.
Because sometimes we change the column datatypes and we do not want to go and change it all over the stored procedures we are in the design processes
_______________________________________-
I know about
SQL
select '@'+column_name+' ',data_type+coalesce('('+cast(character_maximum_length as varchar(10))+')','') from information_schema.columns
where table_name='your_table'

________________________________________-
my stored procedure looks like
SQL
create PROCEDURE [dbo].[usp_UserValidateLogin]
(
@LoginName nvarchar(30),--i want instead or writing nvarchar(30) to pull it automatically
@OrganizationID int,
@Password nvarchar(20),


sarah

[Modified: fixed pre tags]
Posted
Updated 9-Apr-10 12:02pm
v2

1 solution

Not possible with TSQL that I'm aware of
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900