How to export query data from MS SQL Server to text file
How to export query data from MS SQL Server to text file
(OP)
Need to export the MS SQL Server query data to the (fixed)text format below. (e.g. columns/rows must appear in fixed format)
Rout Block_ _Date_ D Bus_ D Trip Time_ On_ Off
392 392001 102008 1 7036 6 0451 25.0 2 0
392 392001 102008 1 7036 0 0516 28.0 7 8
392 392001 102008 1 7036 1 0600 42.0 19 19
392 392001 102008 1 7036 0 0700 48.0 15 18
392 392001 102008 1 7036 1 0800 46.0 17 15
392 392001 102008 1 7036 0 0900 50.0 6 8
392 392001 102008 1 7036 1 1000 48.0 9 10
392 392001 102008 1 7036 0 1100 50.0 20 27
392 392001 102008 1 7036 1 1200 48.0 16 10
392 392001 102008 1 7036 0 1300 50.0 16 18
392 392001 102008 1 7036 1 1400 50.0 31 27
392 392001 102008 1 7036 0 1500 51.0 22 22
392 392001 102008 1 7036 1 1600 48.0 23 23
Rout Block_ _Date_ D Bus_ D Trip Time_ On_ Off
392 392001 102008 1 7036 6 0451 25.0 2 0
392 392001 102008 1 7036 0 0516 28.0 7 8
392 392001 102008 1 7036 1 0600 42.0 19 19
392 392001 102008 1 7036 0 0700 48.0 15 18
392 392001 102008 1 7036 1 0800 46.0 17 15
392 392001 102008 1 7036 0 0900 50.0 6 8
392 392001 102008 1 7036 1 1000 48.0 9 10
392 392001 102008 1 7036 0 1100 50.0 20 27
392 392001 102008 1 7036 1 1200 48.0 16 10
392 392001 102008 1 7036 0 1300 50.0 16 18
392 392001 102008 1 7036 1 1400 50.0 31 27
392 392001 102008 1 7036 0 1500 51.0 22 22
392 392001 102008 1 7036 1 1600 48.0 23 23
RE: How to export query data from MS SQL Server to text file
Rgds,
M.
RE: How to export query data from MS SQL Server to text file
Is there a script or Transact-SQL code that I can run in the SQL Server 2005 Management Studio or the SQLCMD utility to export the data to a "fixed width" text file?
Thanks in advance for any assistance.
RE: How to export query data from MS SQL Server to text file
2. If it's 2005 then it would be SSIS and not DTS
In either case, see previous response - there is an export option of fixed width - or are you asking for something completely different?
RE: How to export query data from MS SQL Server to text file
I will post any other questions in the SQL Server Programming forum instead of the Data Transformation forum.
Thanks again, for all your help.