I keep getting this error when running this script

  • This is my script pretty simple right.

    CREATE PROC sp_UdateWipBinLocations

    AS

    Update dbo.WipJobAllMat

    Set dbo.WipJobAllMat.Bin = dbo.InvWarehouse.DefaultBin

    Where dbo.InvWarehouse.StockCode = dbo.WipJobAllMat.StockCode

    and dbo.WipJobAllMat.Job = dbo.WipMaster.Job

    and dbo.WipMaster.Complete <> 'Y'

    and dbo.WipMaster.JobClassification = '90'or dbo.WipMaster.JobClassification = '96'

    GO

    all the tables are correct in syntax as well as column names

    here are the Error msgs:

    Msg 4104, Level 16, State 1, Procedure sp_UdateWipBinLocations, Line 3

    The multi-part identifier "dbo.InvWarehouse.StockCode" could not be bound.

    Msg 4104, Level 16, State 1, Procedure sp_UdateWipBinLocations, Line 3

    The multi-part identifier "dbo.WipMaster.Job" could not be bound.

    Msg 4104, Level 16, State 1, Procedure sp_UdateWipBinLocations, Line 3

    The multi-part identifier "dbo.WipMaster.Complete" could not be bound.

    Msg 4104, Level 16, State 1, Procedure sp_UdateWipBinLocations, Line 3

    The multi-part identifier "dbo.WipMaster.JobClassification" could not be bound.

    Msg 4104, Level 16, State 1, Procedure sp_UdateWipBinLocations, Line 3

    The multi-part identifier "dbo.WipMaster.JobClassification" could not be bound.

    Please help

  • Update dbo.WipJobAllMat

    Set dbo.WipJobAllMat.Bin = dbo.InvWarehouse.DefaultBin

    FROM dbo.InvWarehouse

    INNER JOIN dbo.WipMaster ON dbo.WipJobAllMat.Job = dbo.WipMaster.Job

    Where dbo.InvWarehouse.StockCode = dbo.WipJobAllMat.StockCode

    and dbo.WipJobAllMat.Job = dbo.WipMaster.Job

    and dbo.WipMaster.Complete <> 'Y'

    and dbo.WipMaster.JobClassification = '90'or dbo.WipMaster.JobClassification = '96'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I really appreciate the help on this I am being split between one Division and another and trying to pull TSQL from the back of my brain from College while still trying to Manage another division at the same time here I agree theory and practical application are 2 different things.

    could you maybe help once more here is the modified code:

    CREATE PROC sp_UdateWipBinLocations

    AS

    Update dbo.WipJobAllMat

    Set dbo.WipJobAllMat.Bin = dbo.InvWarehouse.DefaultBin

    FROM dbo.InvWarehouse

    INNER JOIN dbo.WipMaster ON dbo.WipJobAllMat.Job = dbo.WipMaster.Job

    Where dbo.InvWarehouse.StockCode = dbo.WipJobAllMat.StockCode

    and dbo.WipJobAllMat.Job = dbo.WipMaster.Job

    and dbo.WipMaster.Complete <> 'Y'

    and dbo.WipMaster.JobClassification = '90'or dbo.WipMaster.JobClassification = '96'

    GO

    But I am still getting this one error and it is spelled corretly.

    Msg 4104, Level 16, State 1, Procedure sp_UdateWipBinLocations, Line 3

    The multi-part identifier "dbo.WipJobAllMat.Job" could not be bound.

    Thanks for the help so far it is appreciated,

    R

  • Keep track of your operator presedence!

    UPDATE wjam

    SET wjam.Bin = iw.DefaultBin

    FROM dbo.WipJobAllMat AS wjam

    INNER JOIN dbo.InvWarehouse AS iw ON iw.StockCode = wjam.StockCode

    INNER JOIN dbo.WipMaster AS wm ON wm.Job = wjam.Job

    WHERE wm.Complete <> 'Y'

    AND wm.JobClassification IN ('90', '96')


    N 56°04'39.16"
    E 12°55'05.25"

  • Thanks to all.

    I for got to add dbo.WipJobAllMat in the FROM

    CREATE PROC sp_UdateWipBinLocations

    AS

    Update dbo.WipJobAllMat

    Set dbo.WipJobAllMat.Bin = dbo.InvWarehouse.DefaultBin

    FROM dbo.InvWarehouse, dbo.WipJobAllMat

    INNER JOIN dbo.WipMaster ON dbo.WipJobAllMat.Job = dbo.WipMaster.Job

    Where dbo.InvWarehouse.StockCode = dbo.WipJobAllMat.StockCode

    and dbo.WipJobAllMat.Job = dbo.WipMaster.Job

    and dbo.WipMaster.Complete <> 'Y'

    and dbo.WipMaster.JobClassification = '90'or dbo.WipMaster.JobClassification = '96'

    GO

    Now works perfect.

    Thanks again to all,

    R

  • it is a bad Idea to MIX old syntax with ANSI joins.


    * Noel

  • Also, you named named the procedure sp_ which in has special meaning. Is this in the MASTER database? Is this really what you want?

    In general, you do this only when you need to call this procedure from multiple databases.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply