用T-SQL自定义函数,创建标量值函数 判断一一个数是否为正数,是输出positive?
1个回答
展开全部
很简单,但是以后最好能认真点, 首先你问问提至少要带个请字吧,大学老师留的课题你直接抄过来就完事了?
给你说最后一个
create function f_tableinfo
(
@tableName nvarchar(200)
)
returns @result table (
ColName nvarchar(200),
ColType nvarchar(200),
ColLength int,
ColIsNull bit
)
as
begin
insert into @result(ColName,ColType,ColLength,ColIsNull)
select
c.[name] as ColumnName,
t.[name] as ColumnType,
c.max_length as MaxLength,
c.is_nullable as [IsNull]
from sys.columns c
inner join sys.types t on c.system_type_id=t.system_type_id
where c.[object_id]=object_id(@tableName) and t.[name]<>'sysname'
order by c.column_id
return
end
给你说最后一个
create function f_tableinfo
(
@tableName nvarchar(200)
)
returns @result table (
ColName nvarchar(200),
ColType nvarchar(200),
ColLength int,
ColIsNull bit
)
as
begin
insert into @result(ColName,ColType,ColLength,ColIsNull)
select
c.[name] as ColumnName,
t.[name] as ColumnType,
c.max_length as MaxLength,
c.is_nullable as [IsNull]
from sys.columns c
inner join sys.types t on c.system_type_id=t.system_type_id
where c.[object_id]=object_id(@tableName) and t.[name]<>'sysname'
order by c.column_id
return
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询