|
Publicité ' | |||||||||||||||||||||||
|
|
#1 | ||
|
Membre régulier
![]() Olivier Albertini Inscription : avril 2006 Messages : 194 ![]() |
Bonjour,
j'ai un petit soucis de concaténation, j'utilise SQL Server 2008 voici ma vue : Code :
Je voudrais concaténer les HC_CODE pour avoir des unique HC_ID et avoir la colonne HC CODE qui possède toutes les appellations.. c'est pour un affichage utilisateur. car en application la concaténation prend trop de temps... il y a 532 HC et et une 10zaine d'appellations par HC J'espère avoir été assez clair |
||
|
00
|
|
|
#2 |
![]() ![]() ![]() Frédéric BROUARDExpert SGBDR & SQL Inscription : mai 2002 Messages : 10 953 ![]() |
Utilisez une requête récursive comme celle que j'ai donné dans mon cours ici :
http://sqlpro.developpez.com/cours/s...ursives/#LIV-D A +
__________________
Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL Site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/ Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp. Blog SQL, SQL Server, modélisation données : http://blog.developpez.com/sqlpro http://www.sqlspot.com : modélisation, conseils, audit, optimisation, formation * * * * * Enseignant CNAM PACA - ISEN Toulon - CESI Aix en Provence * * * * * |
|
10
|
|
|
#3 | ||
|
Membre régulier
![]() Olivier Albertini Inscription : avril 2006 Messages : 194 ![]() |
J'essaye mais j'y arrive pas
pouvez vous me dire comment ça fonctionne.. Dans mon cas ma table n'a pas de position Du coup ça boucle à l'infini... Code :
|
||
|
00
|
|
|
#4 |
![]() ![]() ![]() Frédéric BROUARDExpert SGBDR & SQL Inscription : mai 2002 Messages : 10 953 ![]() |
Si vous n'avez pas de clef dans votre table... C'est pas une table c'est un fichier Cobol.
Commencez par le commencement en définissant la clef de votre table. Accessoirement respecter la charte de postage. http://www.developpez.net/forums/a69...gage-sql-lire/ On ne peut pas deviner la structure de votre table ! A +
__________________
Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL Site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/ Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp. Blog SQL, SQL Server, modélisation données : http://blog.developpez.com/sqlpro http://www.sqlspot.com : modélisation, conseils, audit, optimisation, formation * * * * * Enseignant CNAM PACA - ISEN Toulon - CESI Aix en Provence * * * * * |
|
00
|
|
|
#5 | ||||||
|
Membre régulier
![]() Olivier Albertini Inscription : avril 2006 Messages : 194 ![]() |
Oui excusez moi voici les tables qui ont des clées
T_ARBO_PRG: PRG_ID,PRG_NAME,PRG_BD,PRG_BG,PRG_LEVEL,PRG_ROOT,PRG_LEN HC : HC_ID, ... PRG_HC : PRG_ID, HC_ID, HC_ANUM Code :
Code :
Code :
|
||||||
|
00
|
|
|
#6 |
![]() ![]() ![]() Frédéric BROUARDExpert SGBDR & SQL Inscription : mai 2002 Messages : 10 953 ![]() |
Un petit jeu d'essais avec le résultat attendu ferais pas de mal....
A +
__________________
Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL Site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/ Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp. Blog SQL, SQL Server, modélisation données : http://blog.developpez.com/sqlpro http://www.sqlspot.com : modélisation, conseils, audit, optimisation, formation * * * * * Enseignant CNAM PACA - ISEN Toulon - CESI Aix en Provence * * * * * |
|
00
|
|
|
#7 | |||||||
|
Membre régulier
![]() Olivier Albertini Inscription : avril 2006 Messages : 194 ![]() |
Citation:
Code :
Code :
et je voudrais pour HC_ID : Code :
j'espère que vous m'avez compris |
|||||||
|
00
|
|
|
#8 | ||
|
Membre régulier
![]() Olivier Albertini Inscription : avril 2006 Messages : 194 ![]() |
MDR! J'ai trouvé mais je comprend pas xD
Code :
d'autre part j'ai mes codes qui sont concatener mais ils sont collés... comment puis je faire un retour à la ligne pour chaque code ? Sinon c'est super puissant !!! |
||
|
00
|
|
|
#9 | |
![]() ![]() ![]() Frédéric BROUARDExpert SGBDR & SQL Inscription : mai 2002 Messages : 10 953 ![]() |
Citation:
CHAR(13) + CHAR(10) A +
__________________
Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL Site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/ Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp. Blog SQL, SQL Server, modélisation données : http://blog.developpez.com/sqlpro http://www.sqlspot.com : modélisation, conseils, audit, optimisation, formation * * * * * Enseignant CNAM PACA - ISEN Toulon - CESI Aix en Provence * * * * * |
|
|
00
|
Copyright © 2000-2012 - www.developpez.com