Click here to Skip to main content
15,885,004 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

Which Code sample would you use to change the name of the column in the output widnow?

Example 1
SQL
SELECT COUNT(*) AS 'myCount' 
FROM myTable


or

Example 2
SQL
SELECT myCount = COUNT(*) 
FROM myTable


Thanks for your answer :)
Posted
Comments
Leo Chapiro 23-Feb-15 8:48am    
Why don't you try it out?
Member 11426668 23-Feb-15 8:51am    
I tried it already.
Both of them are working. (MS SQL)
Tomas Takac 23-Feb-15 9:11am    
I like #1 better. #2 looks too much like variable assignment.

I see Example 1 as the more often used form.
 
Share this answer
 
Example 1 is a good practice. In case of Example 2 Sql server will create one object with name "myCount", your value will assign to variable "myCount" and it will be displayed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900