Extra Spaces when Generating a text file using OSQL
-
I am using OSQL to generate a text file. The query used to fetch records for the text file returns a variable length record. The text file generated contains extra spaces at the end of the record. The total length of the record including spaces is equal to the databse table field length. Executing the query in Query Analyzer does not give any extra space. Is there any way where I get the record without any extra space in the text file?
-
I am using OSQL to generate a text file. The query used to fetch records for the text file returns a variable length record. The text file generated contains extra spaces at the end of the record. The total length of the record including spaces is equal to the databse table field length. Executing the query in Query Analyzer does not give any extra space. Is there any way where I get the record without any extra space in the text file?
Daredeviljpr wrote: The total length of the record including spaces is equal to the databse table field length Check the datatype of your column. If you use char or nchar, your text will be padded with extra space. If for some reason you can't change the column's data type, just trim the extra space at the end. HTH. Ed
-
Daredeviljpr wrote: The total length of the record including spaces is equal to the databse table field length Check the datatype of your column. If you use char or nchar, your text will be padded with extra space. If for some reason you can't change the column's data type, just trim the extra space at the end. HTH. Ed
I am using varchar as the datatype. I also tried using ltrim, rtrim but of no use. when we run the query in Query Analyzer no spaces are shown but when the text file is generated spaces are padded to the right. I am concatenating the field values to make one column and then generate a text file. Is there any way to remove those extra spaces...