开发者

Scalar Function To Return the Result of A Select

I want a function to find the m开发者_StackOverflow社区aximum allowable length of a field; executed as cmd.ExecuteScalar().

This definition fails, why?

CREATE FUNCTION getPWLen
(
)
RETURNS int
AS
BEGIN
   return select max(len((password))) as return_value from tblSec
END
GO


No need for a column alias, also wrap the SELECT in brackets

...
return (select max(len(password)) from tblSec)
...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜