Questions tagged [select-into-outfile]

34 questions
1
vote
1 answer

MySQL into outfile formatting

select * INTO OUTFILE 'outfile.txt' FIELDS TERMINATED by ',' LINES TERMINATED BY '\n' from nGrams Is there any way I can modify this query to return each row on one line?
CodeKingPlusPlus
  • 15,383
  • 51
  • 135
  • 216
0
votes
0 answers

Docker mysql Outfile permission

How can I set the permission of outfile when executing via stored procedure that using a docker mysql, I can manually change the chown -R root:root or chmod -R 777 but whenever the stored procedure of outfile execute it always has a permission or…
0
votes
1 answer

Write a script to sort words in alphabet order from specific file and put them into 26 text files named A.txt, B.txt, and so on up to Z.txt

I need to sort words alphabetically from a specific file and put them into 26 text files named A.txt, B.txt and so on up to Z.txt. $Content = Get-Content ".\\1.txt" $Content = ($Content.Split(" .,:;?!/()\[\]{}-\`\`\`"")|sort) $linecount =…
0
votes
1 answer

powershell out-file writing zero bytes

I am trying to export the SQL Server query results chunks in to .json file. Here I have large table around the 90GB I need to automate the script using the pagination approach. The following Powershell script is generating within the For loop in c#…
sridharnetha
  • 2,104
  • 8
  • 35
  • 69
0
votes
0 answers

MYSQL - Export data into outfile with pivot-table query

I wrote a script that gather the space used by multiple datasets. My database looks like the below: Date_and_Time Server_Name_and_Drive Space_Used_(Gb) 08/04 00:00 SERVER3 D DRIVE 220 08/04 00:00 SERVER2 D DRIVE 10 08/04 00:00 SERVER1 D…
0
votes
1 answer

writing to a data outfile mysql

This is a bit confusing to me. I am trying to export records out of my database into a csv file using mysql on AWS. I do the select: select BusinessName into outfile '/tmp/test.csv' from contractors limit 2; and I get a message back Query OK, 2…
0
votes
0 answers

in ms access how to export a query to a textfile programattically

I am looking for a way to export a query or table to a text file in Microsoft Access programmatically. That is not using the export wizard. I found examples from other databases (ref below), but when I run the sql code in ms access ... select * into…
quinn
  • 177
  • 1
  • 2
  • 13
0
votes
1 answer

Pass outfile FILE_PATH as parameter when exporting CSV from MySQL query

How do I pass the outfile file path to MySQL? I have tried the below. It does not work. My SQL file SET @query = CONCAT('SELECT * FROM `registered_user` INTO OUTFILE ',@output_location,' FIELDS TERMINATED BY \',\' LINES TERMINATED BY…
Droidme
  • 1,223
  • 6
  • 25
  • 45
0
votes
1 answer

MySQL: wiered chopping for string when using "SELECT INTO OUTFILE"

I exported two fields: name and header from the database using: SELECT name, header INTO OUTFILE '/var/lib/mysql-files/myfile.txt' FIELDS TERMINATED BY '' LINES TERMINATED BY '\n' FROM mytable; One record has this header value: {'Date':…
None
  • 281
  • 1
  • 6
  • 16
0
votes
1 answer

Use LOAD DATA INFILE and SELECT INTO OUTFILE in Cloud SQL

I am testing Google Cloud SQL and I have to test the instructions LOAD DATA INFILE and SELECT...INTO OUTFILE. I understood that the instruction LOAD DATA LOCAL INFILE could be used instead of LOAD DATA INFILE, but how can it be used in Cloud…
0
votes
1 answer

ErrCode with "Select Into Outfile with a variable" - Confusing Permissions

Background: I work with phpMyAdmin (MySQL Workbench) in a mysql DB. I write some PHP code to import data in the DB and execute this with the task scheduler of windows. <= this works fine! Now I want to export some data into a file in a Windows…
0
votes
2 answers

MySQL export into Outfile issue

I created a Stored procedure with a cursor in order to get the info from a few tables into a temp table and then export the result into multiple files, one for each Client ID, the cursor and the loop get all the info right but I'm having syntax…
gusadolfo
  • 65
  • 1
  • 4
  • 11
0
votes
0 answers

 is getting added in the last line of file while fetching data from mysql "INTO OUTFILE" query

I have written a mysql query which selects some rows from a table depending on a condition and writes it to a txt file. But i realized, its inserting a set of additional characters in the last line of the file. Here is the query $sQuery = " (…
vikram
  • 77
  • 8
0
votes
1 answer

Is there anyway to check the execution time(elapsed or remaining) for the "SELECT... INTO OUTFILE" in php mysql?

I am writing a query, which fetches many millions of rows from a table and puts in to a txt file. $sQuery = " ( "; $sQuery .= " SELECT number "; $sQuery .= " INTO OUTFILE '".$outputfile_dnd."' "; $sQuery .= " FIELDS…
vikram
  • 77
  • 8
0
votes
2 answers

phpMyAdmin SQL Error Unrecognized keyword near FIELDS

I'm trying to execute this MySQL to import some data into a csv file. SELECT * FROM purchase WHERE purchase.PO_DATE >= '1-1-2016' INTO OUTFILE "D:\\Reports\\Jan.csv" FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' But I'm…
Mo-
  • 155
  • 15