SELECT * INTO OUTFILE

Résolu
Stef60 Messages postés 257 Statut Membre -  
 jcdd -
Bonjour,
je cherche à effectuer un requête comme ca :

SET @path_export = 'c:\\\\mon_repertoire_export' ;

SELECT * INTO OUTFILE @path_export\\mon_fichier.txt
FIELDS TERMINATED BY ' '
LINES TERMINATED BY '\r\n';

Visiblement SQL n'aime pas la variable @path_export.

Quelqu'un si il est possible de faire une requête comme celle-ci ?
Dois-je obligatoirement mettre le chemin en dur dans ma requête ?

D'avance merci.
Configuration: Windows 2000
Firefox 2.0.0.14

2 réponses

  1. jcdd
     
    Bienvenu au club ...

    Si tu le souhaites, ci-dessous fonctionne avec un chemin absolu en local en dans le même environnement :
    ....

    $sql111 = "CREATE TEMPORARY TABLE IF NOT EXISTS tempo1 AS
    SELECT Id_animal_cote, Diffuse_cotation, Libel_animal_cote, Libel_conformation, Race
    FROM animal
    WHERE `Id_animal_cote` IN ( 20, 38, 50, 105, 111, 123 )";
    $sql1 = "CREATE TEMPORARY TABLE IF NOT EXISTS tabMensuelleCotation AS
    SELECT s.Num_sem_an, s.Date_jour_sem_cotation, a.Diffuse_cotation,
    a.Libel_animal_cote, a.Libel_conformation, a.Race, c.Valeur_cote
    FROM tempo1 a
    LEFT JOIN cotation c ON a.Id_animal_cote = c.Id_animal_cote
    LEFT JOIN seance s ON s.Id_seance = c.Id_seance
    WHERE s.Id_seance IN ( '".($IdSeanceDate-4).
    "', '".($IdSeanceDate-3).
    "', '".($IdSeanceDate-2).
    "', '".($IdSeanceDate-1).
    "', '".$IdSeanceDate."' )";
    $sql11 = "SELECT * INTO OUTFILE 'c:/ExportMensuelle.txt' FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' FROM tabMensuelleCotation";
    // $sql1111 = "SELECT * INTO OUTFILE 'c:/ExportAnimal.txt' FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' FROM tempo1";
    $qr111 = mysql_query($sql111);
    $qr1 = mysql_query($sql1);
    $qr11 = mysql_query($sql11);

    ....
    4
  2. Stef60 Messages postés 257 Statut Membre 41
     
    Resolu
    2