I need to find out whether the following statement has any rows or not. Either by count>=1 or hasrow. Are there any other option beside SqlDataReader & SqlDataAdapter since they might take little longer. Or basically I am looking for faster way to do this.
OR
what if I use this query and do the count on the statement then How would I tell the program look for count >=1
Code:
string strSQL = @"select d.department_name from departments d
where not exists
(select dm.department_name, dm.emp_id from department_membership dm
where (d.department_name=dm.department_name) and (dm.emp_id=@emp_id))
order by d.department_name";
SqlConnection conn = new SqlConnection(connStr);
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(strSQL,conn);
what if I use this query and do the count on the statement then How would I tell the program look for count >=1
Code:
SELECT count(holiday_description) from HOLIDAY_SCHEDULE HS where NOT EXISTS (select holiday_description from HOLIDAY_DESCRIPTION hd WHERE HS.holiday_description=hd.holiday_description)
Comment