Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easily display all column results when executing a query?

Status
Not open for further replies.

nkomokov

Technical User
Nov 9, 2005
14
US
Is there a quick way to get the results pane to display all columns in a table instead of manually listing them off in the query?
 
How do I put it into code like this..

Code:
Select cast(a.Email as char(20)) as Email, 
       convert(char(8),a.FirstName,110) as FirstName,
	a.LastName,
	a.Company,
	a.Title,
	a.MiddleName,
       a.Prefix, 
       a.Country, 
       a.Accreditations 
from dbo.t_contacts a
join 
(select Email 
from dbo.t_contacts
group by Email
having count(*) > 1) b  
on a.Email = b.Email
order by a.Email
 
select * from dbo.t_contacts a
join
(rest of your code)

I'm not sure why you were doing the case in the first select for the email and for the first name, but "select *" isn't going to do the converts/casts if you really needed them.
 
Thanks! You're right, I didn't need it.

Cleaned up my code is this...

Code:
Select 	a.Email,
a.*
from dbo.t_contacts a
join 
(select Email 
from dbo.t_contacts
group by Email
having count(*) > 1) b  
on a.Email = b.Email
order by a.Email
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top