|
Publicité ' | |||||||||||||||||||||||
|
|
#1 |
|
Invité de passage
![]() Inscription : février 2007 Messages : 23 ![]() |
Bonjour,
Lorsque j'exécute la reqête suivante, SYBASE sort en erreur. Le SELECT seul fonctionne, mais en INSERT INTO ça ne fonctionne pas Cette astuce "sale" (convert(datetime,'01' + '/' + substring(convert(char,rate_date,103),5,2) + '/' + substring(convert(char,rate_date,103),1,4),103)) est faite car ce champ est au format INT dans la table d'entrée (je sais ç moche) Auriez-vous une solution à m'apporter ? BEGIN INSERT INTO OPPD01_REF..tbo_suivi_ca_1 (Mois_Valorisation,Total_Calls,Total_Montants) SELECT convert(datetime,'01' + '/' + substring(convert(char,rate_date,103),5,2) + '/' + substring(convert(char,rate_date,103),1,4),103) AS Mois_Valorisation, -- Mois de Communication sum(total_calls) AS Total_Calls, -- NB Total de CDR sum(total_amount) AS Total_Montants -- Sommes des montants FROM OPPD01_DB..NEUF_COMPACTED_CDR GROUP BY convert(datetime,'01' + '/' + substring(convert(char,trans_date,103),5,2) + '/' + substring(convert(char,trans_date,103),1,4),103) END ------------------------ Execute ------------------------ Truncation error occurred. Command has been aborted. (0 rows affected) ------------------------- Done -------------------------- |
|
|
00
|
|
|
#2 |
|
Membre confirmé
![]() Développeur informatique Inscription : octobre 2006 Messages : 181 ![]() |
Quel est le 'format' de ton nombre, AAAAMMJJ, JJMMAAA ... ?
tu selectionnes sur rate_date et tu groupe sur trans_dat !? |
|
|
00
|
|
|
#3 | ||||
![]() ![]() |
Si j'ai bien lu ton code "rate_date" est de la forme AAAAMMJJ.
Dans ce cas tu devrais pouvoir faire comme ceci: Code :
Code :
__________________
Michael Peppler Membre de TeamSybase - www.teamsybase.com "A successful [software] tool is one that was used to do something undreamed of by its author." -- S. C. Johnson |
||||
|
|
00
|
Copyright © 2000-2012 - www.developpez.com