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
 General SQL Server Forums
 New to SQL Server Programming
 Searching Query

Author  Topic 

sajith
Starting Member

1 Post

Posted - 2011-09-27 : 04:36:39
Hi guys,

I would like to create a search query to get a specific row of data from my table.

The query which i used was

select employeeid, employeename
from employee
Where employeeid=1;

i need a quey in which the system asks me to enter the employee id when i run the query and not me specifying it earlier

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-27 : 04:51:35
the prompting part should be done in your front end application. In sql you will add aprocedure to give you required data and it will have empid as a parameter like below


create proc getempdetails
@empid int
as
select employeeid, employeename
from employee
Where employeeid=@empid;


go

then call this procedure from your application as

EXEC GetEmpDetails @empid=1


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -