I have simple Bulk Inserts down. I am trying to take the same type of query and write to a file instead of reading from a file. The opposite of BULK Insert from a File.
If you need a scenario for the example below, I am creating a table from a text file, running a DISTINCT query to remove duplicate rows/lines and then I want to output the deduplicated result to another text file.
My simple BULK Insert query is:
CREATE TABLE dbo.TEMP
(NUMBER40 VARCHAR(16),
BIN VARCHAR(6))
BULK INSERT dbo.TEMP
FROM 'c:\install\InputWithDupes.txt'
WITH
(FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n');
I am trying to do this:
SELECT DISTINCT NUMBER40
FROM dbo.TEMP
INTO OUTFILE 'C:\install\DeDupedOuput.txt'
WITH
(FIELDTERMINATOR = ',' ,
ROWTERMINATOR = '\n');
I would also like to be able to add some logic like WHERE NUMBER40 LIKE '123%' if possible.
Aucun commentaire:
Enregistrer un commentaire