SQLTeam.com | Weblogs | Forums

Exporting to excl


While exporting the query result to excl, one of the fields is getting truncated, Is there a way that I can avoid that ?


Use DTS with SQL Server as a data source and Excel as the data location


If you are using the export wizard, you can change lengths of columns. I have done this on import but have not on export.


You can try exporting the query to Excel 2000 file format by following these steps:

In the Database window, select the table or query on which the report is based.
On the File menu, click Export.
In the Export Table '<Table Name>' dialog box, select Microsoft Excel 97-2002 (*.xls) from the Save as Type box.
Click Export All to export the table. 

Hope this helps :slight_smile:


The query results I am geting is shifting to the next line in EXCL, Is there any way to fix this using REPLACE ?

select t.[Order set Name],t.[Item Name],RTRIM(LTRIM(REPLACE(t.defaultvalue, '#', '?','-','*',' '))) from #tmp t
where defaultvalue<>'' and defaultvalue <>'0'
group by t.[Order set Name],t.[Item Name],[Default Value]

drop table #tmp