SELECT * INTO OUTFILE
Résolu
Stef60
Messages postés
251
Date d'inscription
Statut
Membre
Dernière intervention
-
jcdd -
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.
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.
A voir également:
- SELECT * INTO OUTFILE
- Reboot and select proper boot device asus - Forum Matériel & Système
- Monitor will go into standby mode traduction français ✓ - Forum Matériel & Système
- Please select boot device - Forum Windows 7
- Monitor will go into standby mode ✓ - Forum Matériel & Système
- Message demarrage MONITOR GOING TO SLEEP - Forum Windows
2 réponses
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);
....
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);
....