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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Group headers
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bblosse1
Starting Member

4 Posts

Posted - 07/18/2006 :  12:43:39  Show Profile  Reply with Quote
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 Northwind
GO

SELECT Employees.EmployeeID, Employees.LastName,
Employees.FirstName, EmployeeTerritories.TerritoryID,
Territories.TerritoryDescription
FROM EmployeeTerritories
INNER JOIN Employees ON
EmployeeTerritories.EmployeeID = Employees.EmployeeID
INNER JOIN Territories ON
EmployeeTerritories.TerritoryID = Territories.TerritoryID
WHERE (Employees.EmployeeID = 1) OR
(Employees.EmployeeID = 4)

[Results]
1 Davolio Nancy______06897 Wilton
1 Davolio Nancy______19713 Neward
4 Peacock Margaret___20852 Rockville
4 Peacock Margaret___27403 Greensboro
4 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

USA
7423 Posts

Posted - 07/18/2006 :  12:55:14  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
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
Go to Top of Page

bblosse1
Starting Member

4 Posts

Posted - 07/18/2006 :  13:26:25  Show Profile  Reply with Quote
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 Name
Record #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?
Go to Top of Page

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 07/18/2006 :  14:23:03  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
How are you getting the data from SQL to the text file?

- Jeff
Go to Top of Page

bblosse1
Starting Member

4 Posts

Posted - 07/18/2006 :  15:03:45  Show Profile  Reply with Quote
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.
Go to Top of Page

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 07/18/2006 :  15:19:44  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
sorry, final question: are you using SQL 2005 or 2000?

- Jeff
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000