sql server sp参数数据类型映射为oracle中的列类型 [英] sql server sp parameter data type mapped to column type as in oracle
问题描述
在oracle中,我们可以让存储过程参数的数据类型映射到列示例的数据类型.
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
我们可以在sql中做到吗
存储过程参数数据类型自动获取列datatypeQuestion:
有没有一种方法可以使我在存储过程中不必分配参数的数据类型,而可以从columndata类型中提取它.
因为有时我们会更改列数据类型,而我们不想在整个存储过程中都进行更改,所以我们正处于设计过程中.
_______________________________________-
我知道
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
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
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]
推荐答案
对于我所知道的TSQL不可能
Not possible with TSQL that I''m aware of
这篇关于sql server sp参数数据类型映射为oracle中的列类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!