help with stored procedure error message

  • The message appears quite clear that the columns named 'Level1' and 'Lvl2' are not valid.

    This can mean that the tables/views do not contain these columns or that your login does not have security privileges to select these columns.

    SQL = Scarcely Qualifies as a Language

  • The error shown refers to my case statement where i am using the column name 'Level1' and 'Lvl2' .The thing i dont understand which column name should i use.follwing is the structure of the two tables relating to the stored procedure.

    ---------------------------------------------------------------------------------------

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_PADDING ON

    GO

    CREATE TABLE [dbo].[COST_Uniformat_Category](

     [Uniformat_Category_ID] [int] IDENTITY(1,1) NOT NULL,

     [Uniformat_Category_Code] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,

     [Uniformat_Category_Name] [varchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

     [Uniformat_Category_Level] [int] NULL,

     [Rollup_To_Level1] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

     [Valid_Flag] [bit] NULL,

     [Rollup_To_Level2] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

     CONSTRAINT [XPKCOST_Uniformat_Category] PRIMARY KEY NONCLUSTERED

    (

     [Uniformat_Category_ID] ASC

    )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

    ) ON [PRIMARY]

    GO

    SET ANSI_PADDING OFF

    ------------------------------------------------------------------------------------------

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_PADDING ON

    GO

    CREATE TABLE [dbo].[COST_Project_Phase_Uniformat](

     [Uniformat_Category_ID] [int] NOT NULL,

     [Uniformat_Cost] [money] NULL,

     [Uniformat_Distribution_Percent] [decimal](10, 4) NULL,

     [Uniformat_Rate] [money] NULL,

     [UoM_ID] [int] NULL,

     [Uniformat_Note] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

     [Last_Updated_Dt] [datetime] NULL,

     [Last_Updated_By] [varchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

     [MSBA_ID] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,

     [Project_Phase_ID] [int] IDENTITY(1,1) NOT NULL,

     CONSTRAINT [XPKCOST_Project_Phase_Uniformat] PRIMARY KEY NONCLUSTERED

    (

     [MSBA_ID] ASC,

     [Project_Phase_ID] ASC,

     [Uniformat_Category_ID] ASC

    )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]<script></script>

    ) ON [PRIMARY]

    GO

    SET ANSI_PADDING OFF

    GO

  • Neither table contains a column named "Level1".

    Neither table contains a column named "Lvl2".

    There error is telling you exactly what's wrong. You are using column names that don't exist.

     

     

  • Hi ,

    The columns u have used in the query r not valid.

    Please verify. The column names u have used..

     

    Regards,

    Amit Gupta..

     

Viewing 4 posts - 1 through 5 (of 5 total)

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