Mohan Gupta
Define Execute Scalar?
By Mohan Gupta in ADO.NET on Jul 03 2013
  • Satish
    Sep, 2013 26

    ExecuteScalar() in SqlCommand Object is used for get a single value from Database after its execution. It executes SQL statements or Stored Procedure and returned a scalar value on first column of first row in the Result Set. If the Result Set contains more than one columns or rows , it takes only the first column of first row, all other values will ignore. If the Result Set is empty it will return a Null reference.It is very useful to use with aggregate functions like Count(*) or Sum() etc. When compare to ExecuteReader() , ExecuteScalar() uses fewer System resources.

    • 4
  • sajidlkhan lodi
    Feb, 2015 9

    It execute Query and return Single value

    • 3
  • Bharathi Raja
    Jan, 2018 20

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 2
  • Bhabani Prasad
    May, 2014 21

    Execute scalar is return only one column and one row from database and this is the one of the ADO.Net Command

    • 2
  • Sreekanth Reddy
    Jul, 2013 9

    If we want to fetch only one value from the back end then we can go for Execute Scalar

    • 2
  • Manoj Kumar Duraisamy
    Jan, 2017 3

    The query which returns single result

    • 1
  • Sreekanth Reddy
    Nov, 2015 4

    For fetching a single cell(which rresults from a sql command) value.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • bharat aggarwal
    Oct, 2015 16

    ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.

    • 1
  • Srinivas Pabballa
    Aug, 2015 28

    ExecuteScalar() It is a predefined member method of Command class. Used to execute and return single record at a time from the database. the return of the ExecuteScalar() method is object

    • 1
  • Yatendra Sharma
    Jul, 2015 23

    Its always return one value from database after its execution

    • 1
  • Sujeet Suman
    Jul, 2015 2

    ExecuteScalar returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

    • 1
  • Sreekanth Reddy
    Jun, 2015 17

    returns Single cell as output. Ex: select max sal from empsingle cell. o/p: 34000

    • 1
  • Rahul Prajapat
    May, 2015 26

    It return first column of first row value

    • 1
  • Pankaj  Kumar Choudhary
    May, 2015 26

    it return first element of first column of first row of table as a object.......

    • 1
  • CHANDRAN KANDAN
    Mar, 2015 27

    ExecuteScalar is return a single value,the return values type is integer format.when we want table record count only use this executescalar.

    • 1
  • Munesh Sharma
    Apr, 2014 4

    It is a command object which is used in DML command and it return single value.

    • 1
  • subrat padhy
    Nov, 2013 1

    It is a method of command object. It will return only one value, i.e [object] type.

    • 1
  • Vivek Gupta
    Oct, 2013 12
  • Pramod Lawate
    Aug, 2013 26

    Execute scalar is return only one column and one row from database and this is the one of the ADO.Net Command

    • 1
  • Sandeep Ghosh
    Aug, 2013 15

    It is one of the way to execute select command in sqlserver through code behind. It will return first row's first column as a result. Basically use this sqlcommand when we use aggregate function in Sql Query.

    • 1
  • Bineesh  Viswanath
    Aug, 2013 5

    Execute Scalar is using to retrieve a data from database

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Abhineet Srivastava
    Jul, 2013 18

    It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.

    • 1
  • Srikaran N Sarma
    Jul, 2013 14

    ExecuteScalar is a method of SQLCommand that Executes the query, and returns the first column of the first row of the result set returned by the query. Returns only the first column of the first row. SELECT count(*) FROM table_name;

    • 1
  • nethaji naidu
    Jul, 2013 10

    Execute Scalar is an ADO.NET object which is used to get single value from Back End using Aggregate Functions

    • 1
  • Sreekanth Reddy
    Jul, 2013 9

    If we want to fetch only one value from the back end then we can go for Execute Scalar

    • 1
  • Kunal Vaishya
    Jul, 2013 9

    In Ado.Net Command Execute Scalar always return a Single Object and you have to cast or convert value from this Object you cant directly use it.

    • 1
  • lavanya veerasamy
    Jul, 2013 8

    It is one of the command object in ADO.NET. It will return only a single value. That is 1st column of the 1st row value. Ex: All Aggregate functions.

    • 1
  • Bharat Gunjal
    Jul, 2013 7

    • 1
  • Dhiraj Sharma
    Jul, 2013 6

    Execute Scalar will work with Non-Action Queries(select) that contain aggregate functions.

    • 1


Most Popular Job Functions


MOST LIKED QUESTIONS