Note that there are some explanatory texts on larger screens.

plurals
  1. POError: The multi-part identifier could not be bound, referring to a few lines in my FROM portion of the code
    primarykey
    data
    text
    <p>I keep getting these errors: </p> <blockquote> <p>Msg 4104, Level 16, State 1, Line 80 The multi-part identifier "t.flngKey" could not be bound. Msg 4104, Level 16, State 1, Line 81 The multi-part identifier "t.flngKey" could not be bound. Msg 4104, Level 16, State 1, Line 82 The multi-part identifier "t.flngAccountKey" could not be bound.</p> </blockquote> <pre><code>SELECT t.flngKey AS flngTaskKey, t.fstrAccountType, t.fstrTaskSource, CASE t.fstrCategory WHEN '' THEN '' ELSE t.fstrTaskSource + '_CAT_' + t.fstrCategory END AS fstrCategory, CASE WHEN t.fstrType = '' THEN '' WHEN wd.fstrWorkType = 'SUSIN1' AND wd.fstrOwner = ' ' AND wd.flngworkkey = wr.flngworkkey AND wr.fstrAccountType &lt;&gt; '007' AND wr.fblnOpen = 1 AND EXISTS (SELECT 1 FROM tblIndicator id WHERE id.fstrIndicator = 'EIWTCH' AND id.flngVer = 0 --AND fdtmCease &gt; @pdtmRunDate AND id.flngAccountKey = wd.flngAccountKey) THEN 'Suspended for Audit Indicator - EIC Watch For' ELSE t.fstrTaskSource + '_TYP_' + t.fstrType END AS fstrType, CASE t.fstrStage WHEN '' THEN '' ELSE t.fstrTaskSource + '_STG_' + t.fstrStage END AS fstrStage, ISNULL(t.fdtmFilingPeriod, '31-Dec-9999') AS fdtmFilingPeriod, t.flngKey, t.flngAccountKey, t.flngCustomerKey, '' AS fstrReturnStatus, t.fdtmCreated, t2.fdtmOldestCreated, ISNULL(l.fstrCode, ISNULL(lr.fstrPOCode, '')) AS fstrPOCode, 1 AS flngCount, CASE t.fstrAssignedTo WHEN '' THEN 'Unassigned' ELSE 'Assigned' END AS fstrAssigned, (SELECT t3.fstrOwner FROM t3 WHERE t3.fstrUser = t.fstrAssignedTo) AS fstrOwner, (SELECT t3.fstrSBU FROM t3 WHERE t3.fstrUser = t.fstrAssignedTo) AS fstrUnit FROM tblTaskOpen t with (nolock) LEFT OUTER JOIN WIS_GTIMG.DBO.TBLImgCaseToImage ci with (NOLOCK) ON t.flngkey = ci.flngCaseKey AND t.fstrTaskSource = 'CASE' LEFT OUTER JOIN WIS_GTIMG.DBO.TBLImgIndex i with (NOLOCK) ON ci.flngimagekey = i.flngimagekey AND i.fstrindextype = 'DLN' AND i.fblnValid = 1 LEFT OUTER JOIN WIS_GTEXT.DBO.tblWI_LevyResponse l with (NOLOCK) ON i.fstrIndexId = l.fstrDLN AND i.fstrindextype = 'DLN' AND i.fblnValid = 1 LEFT OUTER JOIN WIS_GTEXT.DBO.TBLWI_letterResponses lr with (NOLOCK) ON i.fstrindexid = lr.fstrDLN AND i.fstrindextype = 'DLN' AND i.fblnValid = 1 , t2 LEFT OUTER JOIN tblWorkToReturn wr ON t.flngKey=wr.flngWorkKey LEFT OUTER JOIN tblWorkDetail wd **-- THE ERRORS REFER TO THESE LINES** ON t.flngKey=wd.flngWorkKey LEFT OUTER JOIN tblIndicator id ON (t.flngAccountKey=id.flngAccountKey AND id.fstrIndicator='EIWTCH') WHERE t.fstrCategory &lt;&gt; 'ABC' AND t.fstrCategory = t2.fstrCategory AND t.fstrType = t2.fstrType AND NOT EXISTS (SELECT 'xyz' FROM tblaudit a WHERE a.flngAuditkey = t.flngKey AND a.fblnPosted = 1 AND t.fstrTaskSource = 'aud') </code></pre> <p>Thanks guys for all the help!</p> <p>--EDIT: FOUND A SOLUTION--</p> <p>I used this to help <a href="https://stackoverflow.com/questions/7314134/the-multi-part-identifier-could-not-be-bound">The multi-part identifier could not be bound</a></p> <p>I edited the code to look like this</p> <pre><code>FROM tblTaskOpen t with (nolock) LEFT OUTER JOIN WIS_GTIMG.DBO.TBLImgCaseToImage ci with (NOLOCK) ON t.flngkey = ci.flngCaseKey AND t.fstrTaskSource = 'CASE' LEFT OUTER JOIN WIS_GTIMG.DBO.TBLImgIndex i with (NOLOCK) ON ci.flngimagekey = i.flngimagekey AND i.fstrindextype = 'DLN' AND i.fblnValid = 1 LEFT OUTER JOIN WIS_GTEXT.DBO.tblWI_LevyResponse l with (NOLOCK) ON i.fstrIndexId = l.fstrDLN AND i.fstrindextype = 'DLN' AND i.fblnValid = 1 LEFT OUTER JOIN WIS_GTEXT.DBO.TBLWI_letterResponses lr with (NOLOCK) ON i.fstrindexid = lr.fstrDLN AND i.fstrindextype = 'DLN' AND i.fblnValid = 1 LEFT OUTER JOIN tblWorkToReturn wr ON t.flngKey=wr.flngWorkKey LEFT OUTER JOIN tblWorkDetail wd ON t.flngKey=wd.flngWorkKey LEFT OUTER JOIN tblIndicator id ON (t.flngAccountKey=id.flngAccountKey AND id.fstrIndicator='EIWTCH'), t2 </code></pre> <p>this got it to work because it left joins against the t table, instead of the t2 table which was listed after. even though you can specify what to join on, these won't necessarily determine which table it is joined on. in this case, since all the subsequent lines of code after t is declared in FROM are joins, they all reference the same table, t. i found that the commas are helpful in determining which table it is joining. notice there are no commas until right before declaring t2.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload