| 
	
		| 
		
			|  | SoftTree Technologies Technical Support Forums
 |  |  
	
		| 
	
	
	
		| Author | Message |  
		| gemisigo 
 
 
 
 
			
				| Joined: 11 Mar 2010 Posts: 2175
 
 |  
 | 
			
				|  Formatting SELECT statements |   |  
				| How can I have my SELECT DISTINCT statements to be formatted like the one below? 
 
	|  |  
	|  | SELECT DISTINCT
 s.name
 ,s.[schema_id]
 ,s.principal_id
 FROM
 sys.schemas AS s
 
 |  
 With
 
 
	|  |  
	|  | SELECT
 ... AS ...
 ,... = ...
 FROM
 ... AS ...
 ,...
 JOIN
 ...
 ON   ... = ...
 AND   ...
 WHERE   ... = ...
 AND   ...
 OR   ...
 GROUP BY
 ...
 ,...
 HAVING
 ...
 ,...
 ORDER BY
 ...
 ,...
 
 |  the result is
 
 
	|  |  
	|  | SELECT
 DISTINCT
 s.name
 ,s.[schema_id]
 ,s.principal_id
 FROM
 sys.schemas AS s
 
 |  
 and this
 
 
	|  |  
	|  | SELECT DISTINCT
 ... AS ...
 ,... = ...
 FROM
 ... AS ...
 ,...
 JOIN
 ...
 ON   ... = ...
 AND   ...
 WHERE   ... = ...
 AND   ...
 OR   ...
 GROUP BY
 ...
 ,...
 HAVING
 ...
 ,...
 ORDER BY
 ...
 ,...
 
 |  does not format SELECT statements at all, regardless there is a DISTINCT or not.
 
 |  |  
		| Wed Jan 25, 2012 6:52 am |     |  
		|  |  
		| SysOp Site Admin
 
 
 
 
			
				| Joined: 26 Nov 2006 Posts: 7990
 
 |  
 | 
			
				|   |   |  
				| I can reproduce the same result, but not sure how to workaround the DISTINCT keyword issue, still looking into this. 
 |  |  
		| Wed Jan 25, 2012 11:35 am |     |  
		|  |  
		|  |  
  
	| 
 
 | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  |  |