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 2000 Forums
 SQL Server Development (2000)
 SQL query error. Invalid column name

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-28 : 09:35:29
Rob writes "SQL Server 7.0SP2, Winnt4Sp6a

The query:

insert into Paid
select Sequence,a.Transit,a.Account,Serial,Amount,Date,0,
cast(getdate()-convert(nvarchar(8),Date) as integer) as AgedLoad
from Image..MicrDB a, ARPPSetup
where (a.Transit = ARPPSetup.Transit and ltrim(a.Account) = ARPPSetup.Account)
and AgedLoad < ARPPSetup.[nDays Stale]
and not exists (select * from Paid where Paid.Sequence = a.Sequence)

The response:

Server: Msg 207, Level 16, State 3, Line 3
Invalid column name 'AgedLoad'.

What in the world is wrong with my query here?? AgedLoad is the number of days old the given item is. If I comment out the comparison (AgedLoad < ...) it works but it's not what I need.

I guess I could insert all the rows and then delete with ones I don't want.

Any help would be appreciated.
--Rob"
   

- Advertisement -