Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you take a mintue and look at this simple query for me?

Status
Not open for further replies.

Tomadams

Programmer
Jun 26, 2001
141
0
0
US
I know this must be simple, but I can not see it. Why are all my Insert field names flagged is invalid??

Thanks

Msg 207, Level 16, State 1, Line 17
Invalid column name 'AmtPaid'.
Msg 207, Level 16, State 1, Line 18
Invalid column name 'PaidFuelAmount'.
Msg 207, Level 16, State 1, Line 19
Invalid column name 'PaidAccesAmount'.
Msg 207, Level 16, State 1, Line 20
Invalid column name 'NetFreight'.
Msg 207, Level 16, State 1, Line 21
Invalid column name 'Billed_PoundsWeight'.
Msg 207, Level 16, State 1, Line 22
Invalid column name 'Billed_KiloGramsWeight'.
Msg 207, Level 16, State 1, Line 23
Invalid column name 'UniqueRecordNBR'.
Msg 207, Level 16, State 1, Line 24
Invalid column name 'BillDate'.


Create Table #PBData
(
PBKey nvarchar (50)
, AmtPaid decimal
, PaidFuelAmount decimal not null default (0)
, PaidAccesAmount decimal not null default (0)
, NetFreight decimal not null default (0)
, Billed_PoundsWeight decimal not null default (0)
, Billed_KiloGramsWeight decimal not null default (0)
, UniqueRecordNBR nvarchar (50)
, BillDate datetime
)

Insert into #PBData
(
PBKey
, AmtPaid
, PaidFuelAmount
, PaidAccesAmount
, NetFreight
, Billed_PoundsWeight
, Billed_KiloGramsWeight
, UniqueRecordNBR
, BillDate
)

select
PB.ProBill_Key
, PB.AmtPaid as AmtPaid
, PB.PaidFuelAmount
, PB.PaidAccesAmount
, PB.NetFreight
, PB.Billed_PoundsWeight
, PB.Billed_KiloGramsWeight
, PB.UniqueRecordNBR
, ProBillDate
from
ViewProbilltbl PB
Inner join ViewClientLocTBL ClientLoc
on ClientLoc.ClientLoc_Key = PB.ClientLoc_Key
where
ClientLoc.Client_Key = 230
and PB.PBStatusCode_Key = 2
and PB.ProBillMethod_Key <> 99
 
Do you have a GO statement between the create table and the insert statement?
 
Nope. I am just testing outside as a query ouside of a stored procedure
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top