Interviews13 answers
What is Difference between "Select 1" and "Print(1)" ?
13 Answers
PRINT 1 will display 1 in message window. select 1 will display 1 in Result window
DHILEEP KUMARPosted Jun 1, 2018, 5:04 AM EDT
Select is a command which return as tabular form while print is a function which give result in message format. Print return values only in varchar format.
sushil kumarPosted Jan 20, 2016, 11:32 PM EST
Select return the value but print function only display.
Joe WilsonPosted Dec 23, 2015, 5:53 AM EST
Select is Used to get result in result window . Print is Used to print any thing for debugging.
Ajay GandhiPosted Nov 20, 2015, 1:20 AM EST
"select" returns the output as table format.
"Print" returns the output as text(not in table format)
Sreekanth ReddyPosted Nov 2, 2015, 6:42 AM EST
Basic difference is that SELECT is Command and PRINT is function
Jaydip JadhavPosted Nov 2, 2015, 3:05 AM EST
1.select is a command and always return output in raw and column while print is a function in SQL and it return a message in varchar format only.
2. select 1 return output in one raw and one column format while print(1) showing 1 in a message not in result window.
naveen sharmaPosted Oct 27, 2015, 11:39 AM EDT
select return the value but print function only display
Atul RawatPosted Oct 20, 2015, 5:27 AM EDT
Select : - Used to get result in result window.
Print : - Used to print any thing as a checkpoint in output window.
Sujeet SumanPosted Sep 1, 2015, 9:11 PM EDT
1)Select is command as it is part of SQL whereas Print is not part of SQL, it is used for debugging.
2)Select return datatype supplied whereas Print return varchar.
But to layman it will give same output of 1
Yogesh GandhiPosted Aug 29, 2015, 6:32 PM EDT
select 1 considered as a table that contain single row and single column , so when you execute this command you will find a message that "
(1 row(s) affected)"
But print('1') is used to print a text in Sql server 's screen
Pankaj Kumar ChoudharyPosted Aug 26, 2015, 9:10 AM EDT
The parameter to the COUNT function is an expression that is to be evaluated for each row. The COUNT function returns the number of rows for which the expression evaluates to a non-null value. ( * is a special expression that is not evaluated, it simply returns the number of rows.)
There are two additional modifiers for the expression: ALL and DISTINCT. These determine whether duplicates are discarded. Since ALL is the default, your example is the same as count(ALL 1), which means that duplicates are retained.
Since the expression "1" evaluates to non-null for every row, and since you are not removing duplicates, COUNT(1) should always return the same number as COUNT(*)
Munesh SharmaPosted Jul 31, 2015, 8:09 PM EDT
Both will give same output i.e 1
but the important difference is that "Select" statement gives output in Result window and
Print() will give output in Message window.
Vishwajeet JhaPosted Jul 26, 2015, 9:49 PM EDT










