Programing

'멀티 파트 식별자'란 무엇이며 바인딩 할 수없는 이유는 무엇입니까?

lottogame 2020. 7. 13. 08:08
반응형

'멀티 파트 식별자'란 무엇이며 바인딩 할 수없는 이유는 무엇입니까?


다른 테이블을 기반으로 테이블을 업데이트하려고 할 때 이러한 오류가 계속 발생합니다. 쿼리를 다시 작성하고 조인 순서를 변경하고 일부 그룹을 변경하면 결국 작동하지만 결국에는 얻지 못합니다.

'멀티 파트 식별자'란 무엇입니까?
'멀티 파트 식별자'는 언제 바인딩 될 수 없습니까?
어쨌든 무엇에 묶여 있습니까?
어떤 경우에이 오류가 발생합니까?
그것을 예방하는 가장 좋은 방법은 무엇입니까?

SQL Server 2005의 특정 오류는 다음과 같습니다.

다중 부품 식별자 "..."을 (를) 바인딩 할 수 없습니다.

예를 들면 다음과 같습니다.

UPDATE  [test].[dbo].[CompanyDetail]

SET Mnemonic = [dbBWKMigration].[dbo].[Company].[MNEMONIC], 
               [Company Code] = [dbBWKMigration].[dbo].[Company].[COMPANYCODE]

WHERE [Company Name] = **[dbBWKMigration].[dbo].[Company].[COMPANYNAME]**

실제 오류 :

메시지 4104, 수준 16, 상태 1, 줄 3 다중 부분 식별자 "dbBWKMigration.dbo.Company.COMPANYNAME"을 바인딩 할 수 없습니다.


멀티 파트 식별자는 여러 부분을 포함하는 필드 또는 테이블에 대한 설명입니다 (예 : MyTable.SomeRow). 바인딩 할 수없는 경우, 무언가 잘못되었음을 의미합니다. 간단한 오타가 있거나 테이블과 열. 테이블 또는 필드 이름에 예약어를 사용하고 []로 묶지 않아서 발생할 수도 있습니다. 목표 테이블에 모든 필수 열을 포함하지 않아서 발생할 수도 있습니다.

redgate sql prompt 와 같은 것은 수동으로 입력하지 않아도되므로 훌륭하지만 외래 키를 기반으로 한 조인 자동 완성조차도 무료는 아닙니다. SQL Server 2008은 인텔리전스를 즉시 지원하지만 레드 게이트 버전만큼 완벽하지는 않습니다.


실제로 때로는 다른 테이블의 데이터에서 하나의 테이블을 업데이트 할 때이 오류를 일으키는 일반적인 문제 중 하나는 테이블 약어를 잘못 사용 하거나 필요하지 않은 경우 입니다. 올바른 진술은 다음과 같습니다.

Update Table1
Set SomeField = t2.SomeFieldValue 
From Table1 t1 
Inner Join Table2 as t2
    On t1.ID = t2.ID

SomeField에서 열 표가 없습니다 t1로 규정 t1.SomeField하지만, 단지입니다 SomeField.

t1.SomeField을 지정 하여 업데이트하려고하면 발견 한 다중 부분 오류가 반환됩니다.


아마 오타 일 것입니다. 코드에서 [schema]. [TableName] (기본적으로 필드를 참조하는 곳)이라고 부르는 곳을 찾아서 철자가 올바른지 확인하십시오.

개인적으로 모든 테이블에 별칭을 사용하여이를 피하려고합니다. 긴 테이블 이름을 설명의 약어 (예 : WorkOrderParts-> WOP)로 단축하고 쿼리를보다 읽기 쉽게 만들 수있을 때 크게 도움이됩니다.

편집 : 추가 보너스로 입력 해야하는 모든 것이 3 자 또는 4 자의 별칭 대 스키마, 테이블 및 필드 이름 모두 인 경우 키 입력의 톤을 절약 할 수 있습니다.


바인딩 = 특정 열의 텍스트 표현은 일부 테이블, 일부 데이터베이스, 일부 서버의 실제 열에 매핑됩니다.

다중 부분 식별자는 MyDatabase.dbo.MyTable입니다. 이러한 식별자 중 하나라도 잘못되면 매핑 할 수없는 다중 부분 식별자가 있습니다.

The best way to avoid it is to write the query right the first time, or use a plugin for management studio that provides intellisense and thus help you out by avoiding typos.


You probably have a typo. For instance, if you have a table named Customer in a database named Sales, you could refer to it as Sales..Customer (although it is better to refer to it including the owner name (dbo is the default owner) like Sales.dbo.Customer.

If you typed Sales...Customer, you might have gotten the message you got.


If you are sure that it is not a typo spelling-wise, perhaps it is a typo case-wise.

What collation are you using? Check it.


When updating tables make sure you do not reference the field your updating via the alias.

I just had the error with the following code

update [page] 
set p.pagestatusid = 1
from [page] p
join seed s on s.seedid = p.seedid
where s.providercode = 'agd'
and p.pagestatusid = 0

I had to remove the alias reference in the set statement so it reads like this

update [page] 
set pagestatusid = 1
from [page] p
join seed s on s.seedid = p.seedid
where s.providercode = 'agd'
and p.pagestatusid = 0

I found that I get these a lot when I try to abbreviate, such as:

Table1 t1, Table2 t2 
where t1.ID = t2.ID

Changing it to:

Table1, Table2 
where Table1.ID = Table2.ID

Makes the query work and not throw the error.


I had this issue and it turned out to be an incorrect table alias. Correcting this resolved the issue.


Mine was putting the schema on the table Alias by mistake:

SELECT * FROM schema.CustomerOrders co
WHERE schema.co.ID = 1  -- oops!

I had P.PayeeName AS 'Payer' --, and the two comment lines threw this error


I actually forgot to join the table to the others that's why i got the error

Supposed to be this way:

  CREATE VIEW reserved_passangers AS
  SELECT dbo.Passenger.PassName, dbo.Passenger.Address1, dbo.Passenger.Phone
  FROM dbo.Passenger, dbo.Reservation, dbo.Flight
  WHERE (dbo.Passenger.PassNum = dbo.Reservation.PassNum) and
  (dbo.Reservation.Flightdate = 'January 15 2004' and Flight.FlightNum =562)

And not this way:

  CREATE VIEW reserved_passangers AS
  SELECT dbo.Passenger.PassName, dbo.Passenger.Address1, dbo.Passenger.Phone
  FROM dbo.Passenger, dbo.Reservation
  WHERE (dbo.Passenger.PassNum = dbo.Reservation.PassNum) and
  (dbo.Reservation.Flightdate = 'January 15 2004' and Flight.FlightNum = 562)

Error Code

FROM                
    dbo.Category C LEFT OUTER JOIN           
    dbo.SubCategory SC ON C.categoryID = SC.CategoryID AND C.IsActive = 'True' LEFT OUTER JOIN          
    dbo.Module M ON SC.subCategoryID = M.subCategoryID AND SC.IsActive = 'True' LEFT OUTER JOIN          
    dbo.SubModule SM ON M.ModuleID = SM.ModuleID AND M.IsActive = 'True' AND SM.IsActive = 'True' LEFT OUTER JOIN 
    dbo.trainer ON dbo.trainer.TopicID =dbo.SubModule.subModuleID 

Solution Code

 FROM                
    dbo.Category C LEFT OUTER JOIN           
    dbo.SubCategory SC ON C.categoryID = SC.CategoryID AND C.IsActive = 'True' LEFT OUTER JOIN          
    dbo.Module M ON SC.subCategoryID = M.subCategoryID AND SC.IsActive = 'True' LEFT OUTER JOIN          
    dbo.SubModule SM ON M.ModuleID = SM.ModuleID AND M.IsActive = 'True' AND SM.IsActive = 'True' LEFT OUTER JOIN 
    dbo.trainer ON dbo.trainer.TopicID = SM.subModuleID 

as you can see, in error code, dbo.SubModule is already defined as SM, but I am using dbo.SubModule in next line, hence there was an error. use declared name instead of actual name. Problem solved.


My best advise when having the error is to use [] braquets to sorround table names, the abbreviation of tables causes sometimes errors, (sometime table abbreviations just work fine...weird)


Adding table alias in front Set field causes this problem in my case.

Right Update Table1 Set SomeField = t2.SomeFieldValue From Table1 t1 Inner Join Table2 as t2 On t1.ID = t2.ID

Wrong Update Table1 Set t1.SomeField = t2.SomeFieldValue From Table1 t1 Inner Join Table2 as t2 On t1.ID = t2.ID


I was getting this error and just could not see where the problem was. I double checked all of my aliases and syntax and nothing looked out of place. The query was similar to ones I write all the time.

I decided to just re-write the query (I originally had copied it from a report .rdl file) below, over again, and it ran fine. Looking at the queries now, they look the same to me, but my re-written one works.

Just wanted to say that it might be worth a shot if nothing else works.


When you type the FROM table those errors will disappear. Type FROM below what your typing then Intellisense will work and multi-part identifier will work.

참고URL : https://stackoverflow.com/questions/206558/what-is-a-multi-part-identifier-and-why-cant-it-be-bound

반응형