Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2010-04-09 : 17:43:32
|
In oracle we can let the datatype of the stored procedure parameter map to the datatype of the columns example CREATE PROCEDURE [CheckCustomer]@customerid onl_Customers.UserID%type Can we do that in sqlstored 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 select '@'+column_name+' ',data_type+coalesce('('+cast(character_maximum_length as varchar(10))+')','') from information_schema.columnswhere table_name='your_table'________________________________________-my stored procedure looks likecreate PROCEDURE [dbo].[usp_UserValidateLogin](@LoginName nvarchar(30),--i want instead or writing nvarchar(30) to pull it automatically@OrganizationID int,@Password nvarchar(20),sarahsarah |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2010-04-09 : 18:25:02
|
Please do not cross post.CODO ERGO SUM |
|
|
|
|
|