create FUNCTION [dbo].[p] ( @c real )
RETURNS TABLE
AS
RETURN
(
if @c=1
select * from tab where a-b>0
else
select * from tab where a-b<0
)
mssql表函数中的条件判断怎么写?
答案:2 悬赏:20 手机版
解决时间 2021-01-18 18:17
- 提问者网友:回忆在搜索
- 2021-01-17 18:30
最佳答案
- 五星知识达人网友:舊物识亽
- 2019-05-03 20:52
应该这样吧
CREATE FUNCTION [dbo].[p] (@c REAL)
RETURNS @tempTable TABLE([ID] INT, [NAME] VARCHAr(50), a int, b int)
AS
BEGIN
IF @c = 1
INSERT INTO @tempTable
SELECt * FROM TAB WHERe a - b > 0
ELSE
INSERT INTO @tempTable
SELECt * FROM TAB WHERe a - b < 0
RETURN
END
CREATE FUNCTION [dbo].[p] (@c REAL)
RETURNS @tempTable TABLE([ID] INT, [NAME] VARCHAr(50), a int, b int)
AS
BEGIN
IF @c = 1
INSERT INTO @tempTable
SELECt * FROM TAB WHERe a - b > 0
ELSE
INSERT INTO @tempTable
SELECt * FROM TAB WHERe a - b < 0
RETURN
END
全部回答
- 1楼网友:轻雾山林
- 2019-08-26 19:48
update table set a=floor(a)
update table set a=round(a,0)
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯