RE: The multi-part identifier could not be bound



Ignore this request. I got it to work by changing the script to use alias'
and it works fine now.




"dtatham" wrote:

I have the following query that runs fine in SQL 2000 but get errors in 2005.


insert into dss_afe_actual_estimate_fact
SELECT dbo.dss_gl_detail_fact.account_key,
dbo.dss_gl_detail_fact.reference_key,
SUM(ISNULL(dbo.dss_gl_detail_fact.balance, 0)) AS afe_actual_amt,
MAX(ISNULL(calsql.share..dbo.AFE_ESTIMATE.amount, 0))
AS afe_estimate_amt
FROM calsql.share.dbo.AFE_ESTIMATE RIGHT OUTER JOIN
dbo.dss_gl_detail_fact ON
calsql.share..dbo.AFE_ESTIMATE.seg3 = dbo.dss_gl_detail_fact.seg3_code AND
calsql.share.dbo.AFE_ESTIMATE.seg1 =
dbo.dss_gl_detail_fact.seg1_code AND
calsql.share.dbo.AFE_ESTIMATE.comp =
dbo.dss_gl_detail_fact.control_company AND
calsql.share.dbo.AFE_ESTIMATE.afe =
dbo.dss_gl_detail_fact.reference_code
GROUP BY dbo.dss_gl_detail_fact.account_key,
dbo.dss_gl_detail_fact.reference_key, dbo.dss_gl_detail_fact.posted_flag,
dbo.dss_gl_detail_fact.reference_code,
dbo.dss_gl_detail_fact.seg3_code
HAVING (dbo.dss_gl_detail_fact.posted_flag = 1) AND
(dbo.dss_gl_detail_fact.reference_code LIKE 'A%') AND
(dbo.dss_gl_detail_fact.seg3_code <> 'ZZZ')

This runs fine in SQL 2000 but when I copy it over to SQL 2005 I get the
following errors.

Note that the only change I made was to prefix the SHARE with the server
name CALSQL everything else is local.

The errors are as follows:

Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "calsql.share..dbo.AFE_ESTIMATE.seg3" could not be
bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "calsql.share.dbo.AFE_ESTIMATE.seg1" could not be
bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "calsql.share.dbo.AFE_ESTIMATE.comp" could not be
bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "calsql.share.dbo.AFE_ESTIMATE.afe" could not be
bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "calsql.share..dbo.AFE_ESTIMATE.amount" could not
be bound.


Any help would be appreciated.





.



Relevant Pages

  • Re: Vista hosting XPe tools/db
    ... Are you running this script on the machine that actually has the SQL server ... machine hosting the database. ... i don't know if you can install a second instance of SQL ...
    (microsoft.public.windowsxp.embedded)
  • Re: ActiveX script works in DTS but not in job, why?
    ... Account that SQL Agent runs under and it is a Local Admin on the box. ... As another test I saved the script as a .vbs file and tried running it, ... Microsoft OLE DB Provider for SQL Server ... that would be since I need to be able to load DTS packages from either a SQL ...
    (microsoft.public.sqlserver.dts)
  • Re: Enterprise Manager Newbie Question
    ... a SQL backup is not a simple copy of the database files. ... Is it possible to write a script that one could run from a workstation and ...
    (microsoft.public.sqlserver.tools)
  • Re: Vista hosting XPe tools/db
    ... here's an alternative script using the Microsoft ADO as ... opposed to the SQL DMO - this should allow this script to work ... Microsoft Windows XP Embedded Test Team ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windowsxp.embedded)
  • Re: SQL Security
    ... except I'm having problems making it work in a script. ... ;Set properties of DB objects and open connection to database ... > from Books Online (within the SQL Server program group): ... > communicate with SQL Server. ...
    (microsoft.public.sqlserver.server)