> 데이터 베이스 > MySQL 튜토리얼 > sql server 标量值函数实例与不能调用原因分析

sql server 标量值函数实例与不能调用原因分析

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
풀어 주다: 2016-06-07 17:47:32
원래의
1512명이 탐색했습니다.

sql server 标量值函数实例与不能调用原因分析,MS SQL 标量值函数,应该在函数前面加上 \"dbo.\",否则会报 “不是可以识别的 内置函数名称”错误

sql server 标量值函数实例与不能调用原因分析
--标量值函数

set ansi_nulls on
go
set quoted_identifier on
go
-- =============================================
-- author:
-- create date:
-- description:
-- =============================================
create function
(
-- add the parameters for the function here

)
returns
as
begin
-- declare the return variable here
declare

-- add the t-sql statements to compute the return value here
select =

-- return the result of the function
return

end


用 ms sql 标量值函数,应该在函数前面加上 "dbo.",否则会报 “不是可以识别的 内置函数名称”错误。例如

  

  declare @whichdb tinyint;
    select @whichdb = user_getwhichdb(1);--看看是哪个的

=================================================

--标量值函数

alter function [dbo].[user_getwhichdb]
(
    @userid int = 0
)
returns tinyint
with execute as caller
as
begin
    declare @whichdb tinyint;
    set @whichdb = 1;
    if @userid >= 115098
        set @whichdb = 2;
   
    return (@whichdb);
end

관련 라벨:
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿