Invalid Column Name

subir.kumar_at_citigroup.com
Date: 05/24/04

  • Next message: subir.kumar_at_citigroup.com: "Pivot and Transform in SQL Server"
    Date: Mon, 24 May 2004 06:09:05 -0700
    
    

    Hi,

    I am writing a stored procedure in SQL Server,but it keeps
    on giving me the same error everytime "Invalid column
    name: FirstOfSub Product Code

    Have tried to change it to FirstProductCode, but it still
    pops the same error.

    Would be grateful if you could advise me on this.

    Thank you,

    Regards,

    Subir

    CREATE PROCEDURE MTDTest

    @strReportClient varchar(255)

    AS

    IF NOT EXISTS( SELECT 1 FROM sysobjects WHERE NAME
    = 'TempMTDReport' )
    CREATE TABLE TempMTDReport (
    [Product Code] NVARCHAR(255) DEFAULT NULL,
    [FirstOfProduct Name] NVARCHAR(255) DEFAULT NULL,
    [Sub Product Code] NVARCHAR(255) DEFAULT NULL,
    [FirstOfSub Product Code] NVARCHAR(255) DEFAULT NULL,
    [Report Client] NVARCHAR(255) DEFAULT NULL ,
    [FirstOfUnit Of Measure] NVARCHAR(255) DEFAULT NULL,
    [FirstOfUnit Price] MONEY(8) ,
    Volume2 FLOAT(10) DEFAULT 0.0 ,
    [SumOfTotal Price] FLOAT(10) DEFAULT 0.0,
    [Billing Cycle Name] SmallDateTime DEFAULT NULL )

    Insert TempMTDReport ([Product Code], [FirstOfProduct
    Name], [Sub Product Code], [FirstOfSub Product Name],
    [Report Client],[FirstOfUnit Of Measure], [FirstOfUnit
    Price], Voulme2, [SumOfTotal Price],[Billing Cycle Name])

    SELECT dbo.tblCurrentMonth.[Product Code],
                    MAX(dbo.tblCurrentMonth.[Product Name]) AS
    [FirstOfProduct Name],
                    dbo.tblCurrentMonth.[Sub Product Code],
                                  MAX(dbo.tblCurrentMonth.[Sub
    Product Name]) AS [FirstOfSub Product Name],
                    dbo.tblExpenseCodes.[Report Client],
                                  MAX(dbo.tblCurrentMonth.[Unit Of
    Measure]) AS [FirstOfUnit Of Measure],
                    MAX(dbo.tblCurrentMonth.[Unit Price]) AS
    [FirstOfUnit Price],
                                  SUM(CASE WHEN
    (dbo.tblCurrentMonth.Volume = 0) THEN 1 ELSE [Volume] END)
    AS Volume2,
                    SUM(dbo.tblCurrentMonth.[Total Price]) AS
    [SumOfTotal Price],
                    dbo.tblCurrentMonth.[Billing Cycle Name]
    FROM dbo.tblExpenseCodes INNER JOIN
                          dbo.tblCurrentMonth LEFT OUTER JOIN
                          dbo.tblSubProductDesc ON
    dbo.tblCurrentMonth.[Sub Product Code] =
    dbo.tblSubProductDesc.[Subproduct Code] ON
                          dbo.tblExpenseCodes.[long code] =
    dbo.tblCurrentMonth.[Long Code]
    WHERE (dbo.tblExpenseCodes.[Report Client] =
    @strReportClient)
    GROUP BY dbo.tblCurrentMonth.[Product Code],
    dbo.tblCurrentMonth.[Sub Product Code],
    dbo.tblExpenseCodes.[Report Client],
                          dbo.tblCurrentMonth.[Unit Of
    Measure], dbo.tblCurrentMonth.[Billing Cycle Name],
    dbo.tblCurrentMonth.[Sub Product Name],
                          dbo.tblCurrentMonth.[Product Name]

    GO


  • Next message: subir.kumar_at_citigroup.com: "Pivot and Transform in SQL Server"

    Relevant Pages

    • Invalid Column Name
      ... on giving me the same error everytime "Invalid column ... name: FirstOfSub Product Code ... [FirstOfUnit Of Measure] ... [FirstOfUnit Price] ...
      (microsoft.public.sqlserver.programming)
    • Invalid column name
      ... on giving me the same error everytime "Invalid column ... name: FirstOfSub Product Code ... [FirstOfUnit Of Measure] ... [FirstOfUnit Price] ...
      (microsoft.public.access.adp.sqlserver)
    • Re: Best way to update multiple prices via a web page
      ... wanting to add their own colours and sizes to products? ... A table to store each colour for each product code on a row by row basis. ... I can also put a price in so that different colours can have ... ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool... ...
      (microsoft.public.inetserver.asp.db)
    • RE: Automatic selection
      ... Create a new tab, call it something that makes sense to you, such as Price ... Sort the table in Ascending Order by Product Code. ... > It doesn't matter if the price shows in the same cell or a different cell. ...
      (microsoft.public.excel.misc)
    • RE: Automatic selection
      ... > Create a new tab, call it something that makes sense to you, such as Price ... Sort the table in Ascending Order by Product Code. ... >> It doesn't matter if the price shows in the same cell or a different cell. ...
      (microsoft.public.excel.misc)