1 Reply Latest reply: May 2, 2017 5:31 AM by LAURENT CLOATRE RSS

    SQL LIMIT

    Bertrand Lantuéjoul

      Bonjour.

       

      a des fin de test, dans mon script, j'ai voulu limité le nombre de résultat requêté pour eviter d'avoir à attendre trop longtemps le chargement de mon scirpt. Au lancement, qlikview me rétorque qu'il y a une erreur de syntaxe vers LIMIT:

       

      ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: Syntaxe incorrecte vers '100000'.

       

      Voici le script.

       

      SQL     SELECT

        DATECREATION,

        DATEANNULATION,

        DATEMISEAJOUR,

        DATEMISEENINSTANCE,

        DATEREFUS,

        DATEVALIDATION,

        CLIENT as Client,

        CLIENTID as [Id Client],

        SPHERE as Sphère,

        SOUSGROUPEID as [Id Sous groupe],

        SOUSGROUPE as [Sous groupe],

        "TYPE PEC" as [Type de PEC],

        TYPEDEMANDE as [Type de demande],

        "MODE RECEPTION" as [Mode de réception],

        MOTIFMISEENINSTANCE as [Motif de mise en instance],

        MOTIFREFUS as [Motif de refus],

        MOTIFREFUSID as [Id Motif de refus],

        NBRE as Volume,

        ETATPEC as [Etat de PEC],

        CASE

        WHEN ETATPEC = 'En Instance'

        THEN

        DATEDIFF(day, DATECREATION, DATEMISEENINSTANCE)

        WHEN ETATPEC = 'Cree' OR ETATPEC IS NULL

        THEN

        CASE

        WHEN DATEMISEENINSTANCE IS NULL

        THEN

        DATEDIFF(day, DATECREATION, GetDate())

        ELSE DATEDIFF(day, DATECREATION, DATEMISEENINSTANCE)

        END

        WHEN ETATPEC = 'Validee' OR ETATPEC = 'Facturee' OR ETATPEC = 'Perimee' OR ETATPEC = 'Rapprochee'

        THEN

        CASE

        WHEN DATEMISEENINSTANCE IS NULL

        THEN

        DATEDIFF(day, DATECREATION, DATEVALIDATION)

        ELSE DATEDIFF(day, DATECREATION, DATEMISEENINSTANCE)

        END

        WHEN ETATPEC = 'Refusee'

        THEN

        CASE

        WHEN DATEMISEENINSTANCE IS NULL

        THEN

        DATEDIFF(day, DATECREATION, DATEREFUS)

        ELSE DATEDIFF(day, DATECREATION, DATEMISEENINSTANCE)

        END

        WHEN ETATPEC = 'Annulee'

        THEN

        CASE

        WHEN DATEMISEENINSTANCE IS NULL

        THEN

        CASE

        WHEN DATEVALIDATION IS NULL

        THEN

        DATEDIFF(day, DATECREATION, DATEANNULATION)

        ELSE DATEDIFF(day, DATECREATION, DATEVALIDATION)

        END

        ELSE DATEDIFF(day, DATECREATION, DATEMISEENINSTANCE)

        END

        END as [Délai de traitement]

               

        FROM "matable"

        LIMIT 100000;

       

       

      Avez-vous une idée ?

       

       

      Cordialement