本文介绍了sql函数无法编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有朋友
过去四小时我遇到过一个问题,但直到找到合适的解决办法才能解决问题。
Dear All friends
I have faced one problem last four hour's, but can't until find proper solution.
alter function _swap_row_value
()
returns @temp table
(
id int not null,
salary int not null,
name varchar(max) not null,
sex varchar(max) not null
)
as
begin
insert into @temp(salary,name,sex) select t.salary,t.name,t.sex from top5 t
update @temp set sex= case sex when 'm' then 'f' when 'f' then 'm'
return;
end;
错误显示如下类型:消息156,级别15,状态1,过程_swap_row_value,第14行
关键字'return'附近的语法不正确。
桌面结构5
Error show like this type : Msg 156, Level 15, State 1, Procedure _swap_row_value, Line 14
Incorrect syntax near the keyword 'return'.
structure of table top5
id salary Name sex
1 1000 joginder m
2 1500 Suresh m
3 1200 vikas f
4 1700 abiminau f
5 500 laxman f
6 1600 bhushan f
7 100 joginder m
8 150 Suresh m
9 12000 vikas f
10 110 abiminau f
11 550 laxman f
12 1510 bhushan f
plz尽快解决我的问题。这种类型的问题在MNC询问。
感谢高级...................
plz solve my problem as soon as possible. This type of question asking in MNC .
thanks for Advanced...................
推荐答案
alter function _swap_row_value
()
returns @temp table
(
id int not null,
salary int not null,
name varchar(max) not null,
sex varchar(max) not null
)
as
begin
insert into @temp(id,salary,name,sex) select t.id,t.salary,t.name,t.sex from top5 t
update @temp set sex= case sex when 'm' then 'f' when 'f' then 'm' else '' end
return;
end;
这篇关于sql函数无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!