IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Développement SQL Server Discussion :

Requête avec CTE : Erreur The multi-part identifier could not be bound


Sujet :

Développement SQL Server

  1. #1
    Candidat au Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2017
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Septembre 2017
    Messages : 2
    Points : 2
    Points
    2
    Par défaut Requête avec CTE : Erreur The multi-part identifier could not be bound
    Bonjour à tous,

    Je commence juste à travailler avec les CTE sous SQL Server, et je n'arrive pas à faire une requête sur 2 tables.
    La requête suivante me retourne le message : The multi-part identifier "et.CodeEtape" could not be bound

    Pouvez-vous me dire ce que je fais mal, je n'arrive pas à trouver...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    WITH Route_CTE AS (
    SELECT [CodeEtapeDestination],[LibelleEtape]
      FROM [dbo].[WU_Route] td, [dbo].[WU_Etape] et
      WHERE td.[CodeEtape]=2 and td.[DefaultRoute]=1 and td.[CodeType]='TYPE1' and td.[CodeEtapeDestination]=et.[CodeEtape]
      UNION ALL
      SELECT td.[CodeEtapeDestination], et.[LibelleEtape] from [dbo].[WU_Etape] et,[dbo].[WU_Route] td
      INNER JOIN Route_CTE rtce ON rtce.[CodeEtapeDestination]=td.[CodeEtape] and td.[DefaultRoute]=1 and td.[CodeType]='TYPE1' and td.[CodeEtapeDestination]=et.[CodeEtape]
      )
      SELECT * FROM Route_CTE
    GO
    Merci d'avance !

    Gaëlle.

  2. #2
    Futur Membre du Club
    Homme Profil pro
    technicien informatique
    Inscrit en
    Septembre 2017
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : technicien informatique
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2017
    Messages : 5
    Points : 5
    Points
    5
    Par défaut Requete avec INNER JOIN ... ON
    Bonjour

    Vous pouvez essayer cette requête (ci-dessous)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
    WITH Route_CTE AS (
    SELECT 
    	td.[CodeEtapeDestination],
    	et.[LibelleEtape]
    FROM 
    	[dbo].[WU_Route] td
    		INNER JOIN [dbo].[WU_Etape] et ON
    		    td.[CodeEtape]=2 and td.[DefaultRoute]=1 and td.[CodeType]='TYPE1' and td.[CodeEtapeDestination]=et.[CodeEtape]
    UNION ALL
    SELECT 
      td.[CodeEtapeDestination], 
      et.[LibelleEtape] 
    FROM 
    	[dbo].[WU_Etape] et 
    		INNER JOIN  [dbo].[WU_Route] td ON
    			td.[DefaultRoute]=1 and 
    			td.[CodeType]='TYPE1' and 
    			td.[CodeEtapeDestination]=et.[CodeEtape]
    		INNER JOIN Route_CTE rtce ON 
    			rtce.[CodeEtapeDestination]=td.[CodeEtape]  
      )
      SELECT * FROM Route_CTE
    La requête utilise les jointures INNER JOIN entre vos tables pour les deux "SELECT"

    Cordialement

    xyzwar

  3. #3
    Candidat au Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2017
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Septembre 2017
    Messages : 2
    Points : 2
    Points
    2
    Par défaut Merci !!!
    C'est super, ça marche parfaitement !
    Merci BEAUCOUP et bonne journée !

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [2012] the multi part identifier could not be bound
    Par Axel_Rose dans le forum MS SQL Server
    Réponses: 1
    Dernier message: 18/06/2013, 17h44
  2. The multi-part identifier "congé.cin" could not be bound.
    Par Gabox dans le forum Développement
    Réponses: 1
    Dernier message: 18/05/2012, 03h06
  3. Réponses: 3
    Dernier message: 01/12/2009, 11h35
  4. update+The multi-part identifier
    Par jawadi95 dans le forum Développement
    Réponses: 2
    Dernier message: 02/06/2008, 10h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo