Possible Duplicate:
The multi-part identifier could not be bound
This is my query that doesn't want to work.
It says: The multi-part identifier "dbo.RunSequenceBatch.RunSequenceBatchName" could not be bound.
Could you please advise?
Thanks in advance!!! :)
SELECT '30 May' AS [Date],
[RunSeq].[RunSequenceBatchName] AS [Batch Job Name] ,
RunSeqCat.CategoryDescription AS [Development Name] ,
[Systems].SystemName AS [System Area] ,
CAST((SUM(DumpSM37_Env3.Duration) / 60) AS NUMERIC(10, 2)) AS [Duration (mins)]
FROM [dbo].[RunSequenceBatch] AS RunSeq
LEFT JOIN DumpSM37_Env3 ON ([RunSeq].[RunSequenceBatchName] = DumpSM37_Env3.[Job]
AND DumpSM37_Env3.[ImportDate] BETWEEN '30 May 2012 00:00:00' AND '30 May 2012 23:59:59'),
[dbo].[RunSequenceType] AS RunSeqType,
[dbo].[RunSequenceFrequency] AS RunSeqFrequency,
RunSequenceCategory AS RunSeqCat, Category, [Systems]
WHERE RunSeq.Status = 'Active'
AND RunSeqFrequency.RunSequenceBatchID = RunSeq.RunSequenceBatchID
AND RunSeq.RunSequenceTypeID = RunSeqType.RunSequenceTypeID
AND RunSeqCat.CategoryDescription = Category.Description
AND Category.SystemArea = [Systems].SystemID
AND DumpSM37_Env3.[Duration] > 0
AND RunSeq.RunSequenceTypeID = 1
AND RunSeqCat.RunSequenceBatchID = RunSeq.RunSequenceBatchID
GROUP BY dbo.RunSequenceBatch.RunSequenceBatchName, DumpSM37_Env3.WorkerProcessID,
ORDER BY [RunSeqFrequency].[Frequency] ASC,
[RunSeqFrequency].[StartTime] ASC
A multipart identifier is any description of a field or table that contains multiple parts - for instance MyTable. SomeRow - if it can't be bound that means there's something wrong with it - either you've got a simple typo, or a confusion between table and column.
You may see an error that says something like Column 'id' in field list is ambiguous . This error means that there is a field name that is present in more than one table, so it needs to be scoped with the table name to avoid ambiguity: using orders.id instead of just id will resolve the issue.
could not be bound. The main reason for this error is that the source table cannot be found, for example if you have statement such as Table1. OrderDate, and then if you get error above, this means that Table1 cannot be found in the query.
Answer: This error message appears when you try to use subquery (correlated or not) that returns more than one value to the calling query. This usually indicates that there are duplicate entries in the column of a table where it's expected to be unique.
Basically, you've mismatched your table names.
In your FROM
you have:
FROM [dbo].[RunSequenceBatch] AS RunSeq
You're aliasing [dbo].[RunSequenceBatch]
In other words, you're stating that from here on out, [dbo].[RunSequenceBatch]
will be referred to as RunSeq
But in your GROUP BY
you don't refer to it using the alias. Because the alias in the only exposed name in the query, dbo.RunSequenceBatch
can't be bound.
Change
GROUP BY dbo.RunSequenceBatch.RunSequenceBatchName
to
GROUP BY RunSeq.RunSequenceBatchName
And you'll be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With