Problem source: http://bbs.csdn.net/topics/370240857
Below is a selection from a database table, TB1:
Based on this data, you need to generate text files of the specified format and with the following names (yyyyMMddHH) by the hour.
After grouping data by the hour, you export every group to a text file according to the specified format (|) and name it after the hour:
A1: Use a SQL to create a database cursor sorted by CreateTime. db represents the connection to a database.
A2-B2: Group data by CreateTime (yyyyMMddHH), and fetch data by loop, one group each time, to export, through B2, to text files named after the create time. And specifiy format for the text data at the same time.
Text files are as follows: