It is very bad habit and difficult to write separate sql query for each operation in sql query. The best solution for this problem is procedure .
Procedure is similar to function which we will learn in next chapter, is collection of code which can be executed at any time.
To create a procedure open sql server, log in and expand database and browse your database. Follow the picture:
Right click Stored Procedures and and select create store procedure . Write the following query to create a store procedure.
Create procedure [dbo].[sp_FetchAdminLogin]
select Id,UserName,Password from dbo.AdminLogin where UserName=@UserName and Password=@Password
General format to create a store procedure is:
create procedure procedure_name(parameter1,parameter2,..)
To execute the procedure write following query:
exec procedure_name parameter1,parameter2
How useful was this post?
Click on a star to rate it!
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!