locked
Msg 102, Level 15, State 1, Procedure V_FactCA_PTdeVu_Pays, Line 20 Incorrect syntax near '.'. RRS feed

  • Question

  • Hi,

    Try to figure out what's this error but can't found why, can you help me pls. There is my program :

    Alter VIEW [dbo].[V_FactCA_PTdeVu_Pays] AS 
    select distinct
    prog_projets_cop.idprojet,
    ANN_PAYS.IdPays,
    prog_projets_cop.pays,
    prog_projets_cop.ISO3166_1_Alpha_2,
    prog_projets_cop.LibelleTypePays,
    YEAR(isnull(prog_projets_cop.DateLivraisonprevue,prog_projets_cop.DateMiseProduction)) as Annee,
    MONTH(isnull(prog_projets_cop.DateLivraisonprevue,prog_projets_cop.DateMiseProduction)) as Mois,
    prog_projets_cop.[idfiliereContribetranger],
    SUM(V_ATH_GDE_BUDGETS.ValeurEurosNonSubventionneOuQuantite) as BudgetDemande  

    FROM PROG_PROJETS_COP
    INNER Join ANN_PAYS
     ON  prog_projets_cop.ISO3166_1_Alpha_2= ANN_PAYS.ISO3166_1_Alpha_2
    INNER JOIN V_ATH_GDE_BUDGETS
     prog_projets_cop.IDProjet = V_ATH_GDE_BUDGETS.IDProjet 
     LEFT OUTER JOIN T_COP_PILOTAGE_FactCA_GroupeLigneCommandes
     ON  prog_projets_cop.IDProjet = T_COP_PILOTAGE_FactCA_GroupeLigneCommandes.IDProjet
     where    LibelleTypePays='Pays d''Accompagnement'
     and archive=0 and dbo.V_ATH_GDE_BUDGETS.LibelleTypeRubrique = 'Charges' and dbo.V_ATH_GDE_BUDGETS.LibelleTypeBudget = 'initial'

    GROUP BY prog_projets_cop.idprojet, ANN_PAYS.IdPays,prog_projets_cop.pays , prog_projets_cop.ISO3166_1_Alpha_2 ,prog_projets_cop.idfiliereContribetranger ,
     LibelleTypePays,V_ATH_GDE_BUDGETS.[ValeurEurosNonSubventionneOuQuantite], 
    prog_projets_cop.DateLivraisonprevue,prog_projets_cop.DateMiseProduction,
    V_ATH_GDE_BUDGETS.LibelleTypeBudget,V_ATH_GDE_BUDGETS.LibelleTypeRubrique

    Regards,

    Friday, February 5, 2016 9:10 AM

Answers

  •  ON  prog_projets_cop.ISO3166_1_Alpha_2= ANN_PAYS.ISO3166_1_Alpha_2
    INNER JOIN V_ATH_GDE_BUDGETS
     prog_projets_cop.IDProjet = V_ATH_GDE_BUDGETS.IDProjet 
     

    Just have a look at line 20; the keyword ON for the join predicate is missing =>

      ON  prog_projets_cop.ISO3166_1_Alpha_2= ANN_PAYS.ISO3166_1_Alpha_2
     INNER JOIN V_ATH_GDE_BUDGETS
     ON prog_projets_cop.IDProjet = V_ATH_GDE_BUDGETS.IDProjet 
      LEFT OUTER JOIN T_COP_PILOTAGE_FactCA_GroupeLigneCommandes


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Naomi N Friday, February 5, 2016 12:32 PM
    • Marked as answer by Eric__Zhang Thursday, February 18, 2016 2:35 AM
    Friday, February 5, 2016 9:14 AM
  • In addition to Olaf's, I see an aggregation on one of the group by column, usually I do aggregation on the not group by column, is that on purpose?

    ,SUM(V_ATH_GDE_BUDGETS.ValeurEurosNonSubventionneOuQuantite) AS BudgetDemande
    .
    .
    GROUP BY ..
    	,V_ATH_GDE_BUDGETS.[ValeurEurosNonSubventionneOuQuantite]
    	.


    Eric Zhang
    TechNet Community Support

    • Marked as answer by Adghar Monday, March 21, 2016 3:29 PM
    Monday, February 8, 2016 4:44 AM

All replies

  •  ON  prog_projets_cop.ISO3166_1_Alpha_2= ANN_PAYS.ISO3166_1_Alpha_2
    INNER JOIN V_ATH_GDE_BUDGETS
     prog_projets_cop.IDProjet = V_ATH_GDE_BUDGETS.IDProjet 
     

    Just have a look at line 20; the keyword ON for the join predicate is missing =>

      ON  prog_projets_cop.ISO3166_1_Alpha_2= ANN_PAYS.ISO3166_1_Alpha_2
     INNER JOIN V_ATH_GDE_BUDGETS
     ON prog_projets_cop.IDProjet = V_ATH_GDE_BUDGETS.IDProjet 
      LEFT OUTER JOIN T_COP_PILOTAGE_FactCA_GroupeLigneCommandes


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Naomi N Friday, February 5, 2016 12:32 PM
    • Marked as answer by Eric__Zhang Thursday, February 18, 2016 2:35 AM
    Friday, February 5, 2016 9:14 AM
  • In addition to Olaf's, I see an aggregation on one of the group by column, usually I do aggregation on the not group by column, is that on purpose?

    ,SUM(V_ATH_GDE_BUDGETS.ValeurEurosNonSubventionneOuQuantite) AS BudgetDemande
    .
    .
    GROUP BY ..
    	,V_ATH_GDE_BUDGETS.[ValeurEurosNonSubventionneOuQuantite]
    	.


    Eric Zhang
    TechNet Community Support

    • Marked as answer by Adghar Monday, March 21, 2016 3:29 PM
    Monday, February 8, 2016 4:44 AM