Why each time I run this SQL code it always generates an error:
Msg 4121, Level 16, State 1, Procedure view_last_documents, Line 38 [Batch Start Line 9] Cannot find either column "dbo" or the user-defined function or aggregate "dbo.get_doc_owner", or the name is ambiguous.
USE [mydb] GO /****** Object: View [dbo].[view_last_documents] Script Date: 1/20/2021 9:54:47 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[view_last_documents] AS select t.id_doc_header , dbo.get_doc_owner(t.id_dokumen_header) as docs_owner , case when (t.id_doc_status = 1) or (t.id_doc_status = 4) or (t.id_doc_status = 6) then sender_code when (t.id_doc_status = 2) or (t.id_doc_status = 3) or (t.id_doc_status = 5) then sender_code when (t.id_doc_status = 10) then '10' end lokasi_terkini_unit , case when (t.id_doc_status = 1) or (t.id_doc_status = 4) or (t.id_doc_status = 6) then sender_code when (t.id_doc_status = 2) or (t.id_doc_status = 3) or (t.id_doc_status = 5) then sender_code when (t.id_doc_status = 10) then 'SUKSES' end lokasi_terkini_bagian , case when (t.id_doc_status = 1) or (t.id_doc_status = 4) or (t.id_doc_status = 6) then id_sub_sender_code when (t.id_doc_status = 2) or (t.id_doc_status = 3) or (t.id_doc_status = 5) then id_sub_sender_code when (t.id_doc_status = 10) then '10' end last_pos from doc_transaction_details t where t.id in ( select max(id) as id_terakhir from doc_transaction_details dt group by dt.id_doc_header); GO
https://stackoverflow.com/questions/65802512/cannot-find-either-column-dbo-while-generating-view-in-sql January 20, 2021 at 11:05AM
没有评论:
发表评论