반응형
열 "dbo" 또는 사용자 정의 함수 또는 집계 "dbo"를 찾을 수 없습니다.splitfn" 또는 이름이 모호함
다음 분할 기능을 사용했습니다.
CREATE FUNCTION dbo.Splitfn(@String varchar(8000), @Delimiter char(1))
returns @temptable TABLE (items varchar(8000))
as
begin
declare @idx int
declare @slice varchar(8000)
select @idx = 1
if len(@String)<1 or @String is null return
while @idx!= 0
begin
set @idx = charindex(@Delimiter,@String)
if @idx!=0
set @slice = left(@String,@idx - 1)
else
set @slice = @String
if(len(@slice)>0)
insert into @temptable(Items) values(@slice)
set @String = right(@String,len(@String) - @idx)
if len(@String) = 0 break
end
return
end
그리고 나는 이 기능을 쿼리에 사용했고 그것은 실행되었습니다.
ALTER PROCEDURE [dbo].[Employees_Delete]
-- Add the parameters for the stored procedure here
@Id varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if exists( select Emp_Id from Employee where Emp_Id=dbo.Splitfn(@Id,','))
begin
update Employee set Is_Deleted=1 where Emp_Id=dbo.Splitfn(@Id,',')
select 'deleted' as message
end
END
하지만 제가 (1,2)라고 말하는 값을 주는 스토어 절차를 실행할 때 오류가 발생했습니다.
Cannot find either column "dbo" or the user-defined
function or aggregate "dbo.Splitfn", or the name is ambiguous.
테이블 값 함수인 'splitfn'을 확인했는데 무엇이 잘못되고 있는지 알 수 없습니다.어떤 제안이든..
테이블 값 함수이지만 스칼라 함수로 사용하고 있습니다.
시도:
where Emp_Id IN (SELECT i.items FROM dbo.Splitfn(@Id,',') AS i)
하지만... 기능을 인라인 TVF로 변경하는 것도 고려해 보십시오. 성능이 더 좋을 것입니다.
테이블 값 udf를 테이블처럼 취급해야 합니다(예: 조인).
select Emp_Id
from Employee E JOIN dbo.Splitfn(@Id,',') CSV ON E.Emp_Id = CSV.items
일반적인 대답
select * from [dbo].[SplitString]('1,2',',') -- Will work
그렇지만
select [dbo].[SplitString]('1,2',',') -- will **not** work and throws this error
Google에서 사람들이 오기 때문에 올바른 데이터베이스에 있는지 확인합니다.
'master' 데이터베이스에서 SQL을 실행하면 이 오류가 반환되는 경우가 많습니다.
Database -> Tables -> Functions -> Scalar Valued Functions - dbo.funcName
rightClick => Properties -> Search UserRoles + Add user access
언급URL : https://stackoverflow.com/questions/2091830/cannot-find-either-column-dbo-or-the-user-defined-function-or-aggregate-dbo-s
반응형
'programing' 카테고리의 다른 글
Internet Explorer 10이 XMLHttpRequest 'xhr을 무시합니다.자격 증명 사용 = true' (0) | 2023.08.15 |
---|---|
Windows 10에서 도커 시스템을 제거하는 방법 (0) | 2023.08.15 |
스크롤로 인해 응답 테이블 내부의 부트스트랩 버튼 드롭다운이 표시되지 않음 (0) | 2023.08.15 |
PHP SOAP Client Class에서 생성된 실제 XML을 보려면 어떻게 해야 합니까? (0) | 2023.08.15 |
jQuery: $.ajax.error 메서드 내에서 HTTP 상태 코드를 가져오는 방법은 무엇입니까? (0) | 2023.08.15 |