Bonjour,

j'ai une requête en Oracle je veux la traduire en Sql Server:

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
24
25
26
27
28
29
30
31
32
33
SELECT b.destination AS LIBRAIRIE,
                SUM (a.GBWRITTEN) AS TAILLE_DES_SAUVEGARDES,
                COUNT (a.GBWRITTEN) AS NOMBRE_DES_SAUVEGARDES
              FROM report_backup a, spec_dest b
WHERE     a.succes != 00
         AND a.specification_n = b.specification_n
         AND a.specification_n NOT LIKE '%Interactive%'
         AND a.TYPE_SESSION = 'Backup'
           and  (a.starttime >  (GETDATE() - 1))
           and destination not like ('MGHIRA%')
GROUP BY b.destination
union
SELECT CASE(SUBSTRING(b.destination,-3,3) ,'VTL' ,'VTL' ) AS LIBRAIRIE,
                SUM (a.GBWRITTEN) AS TAILLE_DES_SAUVEGARDES,
                COUNT (a.GBWRITTEN) AS NOMBRE_DES_SAUVEGARDES
              FROM report_backup a, spec_dest b
WHERE     a.succes != 00
         AND a.specification_n = b.specification_n
         AND a.specification_n NOT LIKE '%Interactive%'
         AND a.TYPE_SESSION = 'Backup'
           and  (a.starttime >  (GETDATE() - 1)) and destination like ('MGHIRA%VTL')
GROUP BY substr(b.destination,-3,3)
union
SELECT CASE (  substring(b.destination,-4,2) ,'CS' ,'Catalyst')  AS LIBRAIRIE,
                SUM (a.GBWRITTEN) AS TAILLE_DES_SAUVEGARDES,
                COUNT (a.GBWRITTEN) AS NOMBRE_DES_SAUVEGARDES
              FROM report_backup a, spec_dest b
WHERE     a.succes != 00
         AND a.specification_n = b.specification_n
         AND a.specification_n NOT LIKE '%Interactive%'
         AND a.TYPE_SESSION = 'Backup'
           and  (a.starttime >  (GETDATE() - 1)) and destination like ('MGHIRA%CS%')
GROUP BY substr(b.destination,-4,2)
* Merci *