110,545
社区成员
发帖
与我相关
我的任务
分享
CREATE FUNCTION WeekString
(
@weekInt int
)
RETURNS VARCHAR(19)
AS
BEGIN
declare @result varchar(19);
set @result=case when @weekInt=1 then '一'
when @weekInt=2 then '二'
when @weekInt=3 then'三'
when @weekInt=4 then '四'
when @weekInt=5 then '五'
when @weekInt=6 then '六'
else '日'
end;
return @result;
END
GO
调用就这样
select dbo.WeekString(2);
select dbo.WeekString(字段1),字段2 From xxx;
CREATE FUNCTION WeekString
(
@weekInt int
)
RETURNS VARCHAR(19)
AS
BEGIN
declare @result varchar(19);
set @result=case when @weekInt=1 then '一'
when @weekInt=2 then '二'
when @weekInt=3 then'三'
when @weekInt=4 then '四'
when @weekInt=5 then '五'
when @weekInt=6 then '六'
else '日'
end;
return @result;
END
GO
调用就这样
select dbo.WeekString(2);
select dbo.WeekString(字段1),字段2 From xxx;
[/quote]
用函数不错。
CREATE FUNCTION WeekString
(
@weekInt int
)
RETURNS VARCHAR(19)
AS
BEGIN
declare @result varchar(19);
set @result=case when @weekInt=1 then '一'
when @weekInt=2 then '二'
when @weekInt=3 then'三'
when @weekInt=4 then '四'
when @weekInt=5 then '五'
when @weekInt=6 then '六'
else '日'
end;
return @result;
END
GO
调用就这样
select dbo.WeekString(2);
select dbo.WeekString(字段1),字段2 From xxx;
[/quote]谢谢