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)
 Pls help me with this stored procedure

Author  Topic 

clubber
Starting Member

20 Posts

Posted - 2001-03-10 : 15:26:40
CREATE PROCEDURE ReturnEmployeeName(@Searchbox varchar(50))


As
Declare @parameter varchar(50)
Select @parameter = "%" + @Searchbox + "%"

Begin

Select 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,EmployeeContact EC, EmployeePhone EP, Link L

where E.EmployeeName like @parameter and ( E.EmployeeID = EP.EmployeeID and E.EmployeeID = EC.EmployeeID and E.EmployeeID = L.EmployeeID)

Order by E.EmployeeName

end


What i want is to search for employees first where the name is like what will be passed in and that actually works (typed in joe and returned 30 rows - all names with joe) but I also want other info about each row returned which is from 3 other tables. Any info from those tables are not required tho, just if they have other info from those tables, then I want them returned, if not that's ok.

Anyone can help me here?

   

- Advertisement -