October 1, 2010 at 1:49 pm
When we are loading the data from sql to CSV. Can we set the colum width of the destination. Say if we have text in column of length 10, then can we set the width to the same in CSV, so that when we see the CSV, we should able to see the entire text. Hope you all got me.
Please Advice.
October 1, 2010 at 1:56 pm
Are you having difficulty with this, or just checking to see if it is possible?
The nature of CSV files is that each column is output for each row at exactly the size required to fit all of the column data. This makes each row in the CSV file a different length based on the actual data in each row.
By default, you should always be able to see the entire contents of the column.
October 1, 2010 at 2:00 pm
There really isn't enough information to do anything with here - what method are you using to load the data? SSIS? DTS Package? 3rd party tool?
October 1, 2010 at 2:27 pm
jerry-621596 (10/1/2010)
Are you having difficulty with this, or just checking to see if it is possible?The nature of CSV files is that each column is output for each row at exactly the size required to fit all of the column data. This makes each row in the CSV file a different length based on the actual data in each row.
By default, you should always be able to see the entire contents of the column.
It looks like below when I load the data.
But I want to see the data in this manner
October 1, 2010 at 2:28 pm
getoffmyfoot (10/1/2010)
There really isn't enough information to do anything with here - what method are you using to load the data? SSIS? DTS Package? 3rd party tool?
Well, I am using SSIS 2008 To Load the data.
October 2, 2010 at 2:44 am
I'm assuming that you're then using Excel to open the CSV, and want all of the column's auto-sized?
Setting the width in a CSV file defeats the nature of a CSV - each piece of data is delimited with a comma.
Perhaps what you're thinking about is fixed format file? Or convert all of the columns to a fixed character length (I'd use the select statement to convert them, but you could do it also with a derived column task)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply