Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help me here using Count function pls

Author  Topic 

clubber
Starting Member

20 Posts

Posted - 2001-03-14 : 15:43:24
I have this stored procedure

CREATE PROCEDURE ReturnEmployeeName
@Searchbox varchar(50)
As
Declare @parameter varchar(55)
SET @parameter = '%' + @Searchbox + '%'
SELECT Count(E.EmployeeID)"Number of records", E.EmployeeName, E.EmployeeAddress, E.City, E.Province, E.PostalCode,
E.EmailAddress, EP.PhoneType, EP.PhoneNumber, EC.ContactFirstName,
EC.ContactLastName, L.Location, E.EmployeeID, EP.EmployeeID,
EC.EmployeeID, L.EmployeeID
FROM Employee E LEFT JOIN EmployeeContact EC ON EC.EmployeeID=E.EmployeeID
LEFT JOIN EmployeePhone EP ON EC.EmployeeID=EP.EmployeeID
LEFT JOIN Link L ON EC.EmployeeID=L.EmployeeID
WHERE E.EmployeeName LIKE @parameter and l.URLType = 'P'
ORDER BY E.EmployeeName

But I cant make it to work, I am getting aggregate error or something. The procedure works fine until I add the count function as I want to count all the records. Thanks


   

- Advertisement -