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.
Author |
Topic |
bblosse1
Starting Member
4 Posts |
Posted - 2006-07-18 : 12:43:39
|
Hello! I'm new to the site, can you help me?I think this would be a simple SQL problem. Maybe not.I have a script example:USE NorthwindGOSELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName, EmployeeTerritories.TerritoryID, Territories.TerritoryDescriptionFROM EmployeeTerritories INNER JOIN Employees ON EmployeeTerritories.EmployeeID = Employees.EmployeeID INNER JOIN Territories ON EmployeeTerritories.TerritoryID = Territories.TerritoryIDWHERE (Employees.EmployeeID = 1) OR (Employees.EmployeeID = 4)[Results]1 Davolio Nancy______06897 Wilton 1 Davolio Nancy______19713 Neward4 Peacock Margaret___20852 Rockville 4 Peacock Margaret___27403 Greensboro4 Peacock Margaret___27511 Cary I really need it to provide results like this:1 Davolio Nancy______19713 Neward ______06897 Wilton 4 Peacock Margare______20852 Rockville ______27403 Greensboro ______27511 Cary Any ideas?Thanks,Brad |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-07-18 : 12:55:14
|
This is a presentation issue, not a T-SQL issue. Formatting should be done at the presentation layer (i.e., your client app or report writing tool or webpage -- however you are ultimately presenting the data that is returned from SQL Server).- Jeff |
|
|
bblosse1
Starting Member
4 Posts |
Posted - 2006-07-18 : 13:26:25
|
Thank you Jeff. Actually, I am fulfilling data specifications. I'm pulling this data out of SQL in a flat file that will then be pulled into another system. So I was eventually trying to use a DTS for delivering this. Is there a better product to use for this? The specifications determine that I need different records in the detail.Record #1 Employee NameRecord #2___Territories(#)Record #2___Territories(#)I originally tried to use Crystal Reports to provide this, which does an okay job, but the positions can't be hard coded so much, and I can't schedule crystal to produce data without using an external program. Any suggestions? |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-07-18 : 14:23:03
|
How are you getting the data from SQL to the text file?- Jeff |
|
|
bblosse1
Starting Member
4 Posts |
Posted - 2006-07-18 : 15:03:45
|
Sorry, I should have said, I'm pulling data out of SQL INTO a flat file. I'm trying to produce a fixed width file from an SQL statement, and scheduling it with a DTS. |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-07-18 : 15:19:44
|
sorry, final question: are you using SQL 2005 or 2000?- Jeff |
|
|
|
|
|
|
|