C# Tutorials and offshore development in India
Tutorials Resources Forum Reviews Communities Interview Jobs Projects Training Videos


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...


Birthday Greetings
Learn Windows 7: Windows Keyboard Shortcuts   I provide you some important keyboard shortcuts of windows operating system. These shortcuts are probably mostly using shortcuts by the users.



Forums » .NET » SQL Server »

Exporting SQL Server Table to Excel Using DTS


Posted Date: 19 Nov 2004      Posted By:: www.DotNetVJ.com    Member Level: Diamond    Member Rank: 0     Points: 5   Responses: 3



HI Gurus,
I have a table in SQL Server. see Below the Table Definition.

CREATE TABLE testcarrreturn
(
ide INT,
val VARCHAR(100)
)
GO
INSERT testcarrreturn
SELECT 1, 'block1 \' + char(13) + char(10) + 'block2 \' + char(13) + char(10) + 'block3'

If i export this table data to Excel file using DTS i am getting some junk data in "val" field. and also a single quote is appending to the data. i dont have any idea why this is happening. could any one plzz get the solution for me.it would be gr8. this will add a gr8 amount of Performance hike in my career.

Thanx -- Vj

Thanks -- Vijaya Kadiyala
http://www.DotNetVJ.com
Microsoft MVP
Me & My Little Techie





Responses

Author: Atal Bihari Upadhyay     Member Level: Gold      Member Rank: 0     Date: 20/Nov/2004   Rating: 2 out of 52 out of 5     Points: 2

Hey Krishna,

I am getting the values properly withourt any jusk data and without any quote.
Here is the result.
ide val
1 "block1 \
block2 \
block3"


Pls check the destination (type of excel driver) you are using for export.

Regards.



Author: www.DotNetVJ.com     Member Level: Diamond      Member Rank: 0     Date: 22/Nov/2004   Rating: 2 out of 52 out of 5     Points: 2

Hi Atal,
Could u plzz Tell me What was/is teh driver u have selected to Export is to Excel from SQL Server.
Thanx -- Vijay

Thanks -- Vijaya Kadiyala
http://www.DotNetVJ.com
Microsoft MVP
Me & My Little Techie



Author: Tejinder Singh Barnala     Member Level: Gold      Member Rank: 190     Date: 23/Dec/2008   Rating: 2 out of 52 out of 5     Points: 2

remover char function from your insert statement and insert data like

INSERT testcarrreturn
SELECT 3, 'block1 \ ' + ' block2 \ ' + 'block3'

it will work for u

Many Thanks
Tejinder Singh Barnala
/*I have the simplest tastes. I am always satisfied with the best*/
SubmitYourQuery/Read New tricks



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Previous : Function is not working
Return to Discussion Forum
Post New Message
Category: SQL Server



About Us    Contact Us    Privacy Policy    Terms Of Use