Recently, when processing an SQL query record, I encountered some problems. After multiple queries and explorations, I summarized the following: for example, I used SQL to query a table and obtained all license plates. Then, I took these license plates and converted them into license plate numbers 1, license plate numbers 2 ,..... license plate number n, and the final result is required to be written to a text file. There is no space, and before the line break, my
Recently, when processing an SQL query record, I encountered some problems. After multiple queries and explorations, I summarized the following: for example, I used SQL to query a table and obtained all license plates. Then, I took these license plates and converted them into license plate numbers 1, license plate numbers 2 ,..... license plate number n, and the final result is required to be written to a text file. There is no space, and before the line break, my
I recently encountered some problems when processing an SQL query record. After multiple queries and explorations, I will summarize the following:
For example, I used SQL to query a table and obtain all the license plates. Then, I took these license plates and converted them into 'license plate number 1', 'license plate number 2 ',..... 'license plate number n', and the final result is required to be written to a text file. There are no spaces, line breaks, and so on.
My previous practice was to take the results to excel, write them to column A1, and then in column B1, B1 = "'" & A1 &"'", in this way, you can add ''to the license plate number''
Example:
Guangdong A00000
Guangdong A00001
Guangdong A00002
Guangdong A00003
Guangdong A00004
Guangdong A00005
Guangdong A00006
After conversion
'Guangdong a0000001'
'Guangdong A00002'
'Guangdong A00003'
'Guangdong A00004'
'Guangdong A00005'
'Guangdong A00006'
'Guangdong A00007'
Then, I copied the B1 column to notepad ++ (not notepad, this is too weak)
Then ctrl + H, set replace, find \ n and replace it,
Then, you need to remove the blank space. Select "edit" and click "blank" to convert "EOL" to "space ".
The final result is: 'guangdong a00000', 'guangdong a0000000000000000000000000000000000000000000000000000000000000000000000000000000000'
In fact, this is still very troublesome. After several conversions, I checked notepad ++. In fact, there is a simpler method. I can replace it twice.
For example, we still retrieve a column of data from the SQL query results to notepad ++
Then replace \ n ,'
The first replacement result is:
Guangdong A00000
, 'Guangdong A00001
, 'Guangdong A00002
, 'Guangdong A00003
, 'Guangdong A00004
, 'Guangdong A00005
, 'Guangdong A00006
,'
Then replace it with the find target \ r'
Result:
Guangdong a00000', 'guangdong a0000000000000000000000000000000000000000000000000000000000000000000000000000 ','
Then manually change the first and last two.
I hope you can give us a simpler method. It is very troublesome to replace and modify this method recently.