12
Reply

What is Difference between "Select 1" and "Print(1)" ?

Vishwajeet Jha

Vishwajeet Jha

Jul 27, 2015
2.6k
0

    Basic difference is that SELECT is Command and PRINT is function

    Jaydip Jadhav
    November 02, 2015
    2

    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 Sharma
    August 01, 2015
    2

    Select return the value but print function only display.

    Joe Wilson
    December 23, 2015
    1

    select return the value but print function only display

    Atul Rawat
    October 20, 2015
    1

    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 Gandhi
    August 29, 2015
    1

    Both will give same output i.e 1but the important difference is that "Select" statement gives output in Result window and Print() will give output in Message window.

    Vishwajeet Jha
    July 27, 2015
    1

    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 kumar
    January 21, 2016
    0

    Select is Used to get result in result window . Print is Used to print any thing for debugging.

    Ajay Gandhi
    November 20, 2015
    0

    "select" returns the output as table format. "Print" returns the output as text(not in table format)

    Srikanth Reddy
    November 02, 2015
    0

    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 sharma
    October 27, 2015
    0

    Select : - Used to get result in result window. Print : - Used to print any thing as a checkpoint in output window.

    Sujeet Suman
    September 02, 2015
    0

    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 Choudhary
    August 26, 2015
    0