Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Exporting from SQL Server to Text File

Author  Topic 

gcsreddy
Starting Member

5 Posts

Posted - 2000-12-12 : 05:39:56
I am using SQL Server 2000. I am having trouble in exporting data from SQL Server to Text File.
Columns of the type varchar(510) and varchar(1024) are being truncated to 255 bytes when exported to text file. I used Import/Export wizard. Why is it happening so ? Is there anyway to avoid this ?

dr fonz
Starting Member

6 Posts

Posted - 2002-07-05 : 09:23:12
I've had this problem too, there don't seem to be any settings which can fix it. The same happens if you export to a XL spreadsheet. I guess MS forgot that they extended the varchar beyond 255 when they wrote the DTS stuff?!

Anyway. The only way I found to get round it was to export with a query, not a table, and convert the long varchar to a text field in the export; eg:

SELECT ID, CONVERT(text, BigVarcharField) AS BigVarcharField FROM MyTable

Throw the query into a SP to save effort etc. if you like.

It's a bit laborious if you're just trying to whack off a quick export, but it works if you're desperate!

Guess it's best to steer clear of text files, they are a very dated medium after all ;)

'f course, if anyone has a better idea...

Go to Top of Page
   

- Advertisement -