sql server - sqlserver scalar function returning result of select -


i want function find maximum allowable length of field. invoke in behind code, using cmd.executescalar(). however, can't function definition right.

this 1 of things tried:

create function getpwlen ( ) returns int begin    return select max(len((password))) return_value tblsec end go 

any appreciated.

no need column alias, wrap select in brackets

... return (select max(len(password)) tblsec) ... 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -