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
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