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 2005 Forums
 Transact-SQL (2005)
 turn horizontal data to vertical

Author  Topic 

rajani
Constraint Violating Yak Guru

367 Posts

Posted - 2008-07-31 : 19:17:40
Hi Guys
need your expert advise here. I send emails using sp_send_dbmail as part of some maintenance job. I send qery results as attachments all works fine but it's bit difficult to read in notepad .
I mean the data look like this
VendorID Employee Orders
1 Emp1 4
1 Emp2 3

I want it to convert like this
VendorID 1
Employee Emp1
Orders 4

VendorID 1
Employee Emp2
Orders 3

how do write sql stmt to accomplish this ? Thanks for the advise

Cheers

dshelton
Yak Posting Veteran

73 Posts

Posted - 2008-07-31 : 21:33:53
Are you using a separator's in your results. If you rename this file to a .csv file and open this in Excel it will be presented alot better than notepad.
Go to Top of Page
   

- Advertisement -