SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 
        
Home       Members    Calendar    Who's On



Equivalent for SQL-Plus's "BREAK ON" in T-SQL Expand / Collapse
Author
Message
Posted Friday, April 24, 2009 1:24 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, October 15, 2009 2:22 PM
Points: 24, Visits: 101
Hello,

I am trying to create a view which gives records. Some of them have the same values over most of the fields. My goal is to group them by these fields. But, I cannot just group by these fields, I would have to group by all the fields in the "select" clause.

I know of a command called "Break on" in Oracle SQL-Plus. This creates a line break when it finds a unique record. So the repeating record gets listed only once. However, this command doesn't seem to be working for SQL Server. I want to know an equivalent of that so that I would have the repeating record listed just once.

Any help on this would be truely appreciated

Thanks
Shruti
Post #704272
Posted Friday, April 24, 2009 1:26 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 2:46 PM
Points: 7,642, Visits: 4,157
I don't believe there is such a function in T-SQL. But I'd also say that this kind of thing should be done in the presentation layer, not in the database. Should be very easy to do in your application, I would think.

- GSquared

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #704273
Posted Saturday, April 25, 2009 12:13 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 7:52 AM
Points: 2,241, Visits: 2,746
So the repeating record gets listed only once.


This sounds like a SELECT DISTINCT query. It returns only the unique combinations of all columns included in the SELECT list.


__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Whenever possible, I prefer to eat the rude. -- Hannibal Lecter
Post #704387
Posted Thursday, June 18, 2009 8:27 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, August 11, 2009 11:26 AM
Points: 92, Visits: 282
GSquared (4/24/2009)
I don't believe there is such a function in T-SQL. But I'd also say that this kind of thing should be done in the presentation layer, not in the database. Should be very easy to do in your application, I would think.


I understand this, but do you the following is possible in T-SQL?

Assume the format of the data is in the following:

A     B     C     D
A B C D
A B C D
A B C D

Is there a way to render the output as the following?

A     B          D
C
A B D
C
A B D
C
A B D
C

Thanks for any help
Post #737601
« Prev Topic | Next Topic »


Permissions Expand / Collapse