Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Msg 207 - Invalid column name
Message
From
03/11/2016 15:48:36
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Msg 207 - Invalid column name
Miscellaneous
Thread ID:
01642693
Message ID:
01642693
Views:
41
I'm trying to write a stored procedure in Sql Server 2012. Included is..........
SELECT * INTO #Attrib FROM spot_light_Dbo...prodattrib WHERE crefpart <> ''

   SELECT commits.*, SPACE(30) as Part_No, SPACE(5) as Revision, SPACE(40) as Customer, SPACE(10) as Type,SPACE(35) AS refPartNo,
		  SPACE(10) as Part_Class, space(3) as buyer_type,so.price,ack.sono,ack.poack,
		  ISNULL(atr.nSMT_PlcMnts, 00000) As nSMT_PlcMnts, 
		  ISNULL(atr.nSMT_LItems, 00000) As nSMT_LItems, ISNULL(atr.nCalc_Comp, 1) As nCalc_Comp, 
		  ISNULL(atr.nBtlNkTPut, 00000.00) As nBtlNkTPut, ISNULL(atr.nProdCt, 00000.00) As nProdCt ,
		  ISNULL(atr.nBtlNkYld, 000) As nBtlNkYld, Space(250) As Sub_Assy, NULL As ShipStart, 
		  0000000.00 As DailyShip, NULL As ShipEnd, atr.cCritComnt, cBtlNkOp As BtlNkOp, nKit_LItems    	  
   INTO #target
   FROM table
      JOIN other table
      JOIN (select statement)
      JOIN #attrib atr
#attrib comes from a linked MySql database
the fields in the select statement related to this table are red underlined, but the procedure will compile

Now I add a couple of update statements
UPDATE #target SET type = 'FORECAST' WHERE ref like 'FC%'; --> no problem saving
UPDATE #target SET revision = part_no  --> no problem saving
UPDATE #target SET refPartNo = part_no --> Msg 207, Level 16, State 1 Invalid column name 'refPartNo'
The update for refPartNo isn't color-coded as a potential problem but it won't save.

I've checked five or six other fields (other than the ones which came from #attrib) and I don't see any issues with them.

I have pasted this code into a separate window and it runs just fine. It just won't save as a Stored Procedure.

All help greatly appreciated.

.......Rich
Next
Reply
Map
View

Click here to load this message in the networking platform