Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Stored Proc with Inner Join

Author  Topic 

Antz
Starting Member

7 Posts

Posted - 2011-07-12 : 08:28:11
I am trying to create a Stored Proc to move transactions from one table to another with 'INNER JOIN' to other Tables as a filter but getting an Invalid column name of the field in the where clause. any ideas how to resolve this?

INSERT INTO PostStaging.dbo.[Invoice_Payment_Schedules_Hist]
OUTPUT INSERTED.*
SELECT DISTINCT
dbo.Invoice_Payment_Schedules.CNTBTCH, dbo.Invoice_Payment_Schedules.CNTITEM, dbo.Invoice_Payment_Schedules.CNTPAYM,
dbo.Invoice_Payment_Schedules.DATEDUE, dbo.Invoice_Payment_Schedules.AMTDUE, dbo.Invoice_Payment_Schedules.DATEDISC,
dbo.Invoice_Payment_Schedules.AMTDISC, dbo.Invoice_Payment_Schedules.AMTDUEHC, dbo.Invoice_Payment_Schedules.AMTDISCHC
FROM dbo.Invoices INNER JOIN
dbo.Invoice_Payment_Schedules ON dbo.Invoices.CNTITEM = dbo.Invoice_Payment_Schedules.CNTITEM INNER JOIN
dbo.Invoice_Details ON dbo.Invoices.AMTNETTOT = dbo.Invoice_Details.AMTEXTN
WHERE (dbo.Invoices.INVCDESC LIKE '%99%')

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-12 : 09:09:24
check that you prefix the correct table name to the column.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Antz
Starting Member

7 Posts

Posted - 2011-07-12 : 09:14:49
I have used a fully qualified path name - DB Name.dbo.Invoices.INVCDESC and it still gave the same error
Go to Top of Page
   

- Advertisement -