Computer Science, asked by sanjeevsony9206, 1 year ago

create stored procedure in sql

Answers

Answered by Anonymous
0
hyy mates

here is ur answer

In Object Explorer, connect to an instance of Database Engine and then expand that instance.

Expand Databases, expand the AdventureWorks2012 database, and then expand Programmability.

Right-click Stored Procedures, and then click New Stored Procedure.

hope this will help you
Answered by aatif5
2
In Object Explorer, connect to an instance of Database Engine and then expand that instance.

Expand Databases, expand theAdventureWorks2012 database, and then expand Programmability.

Right-click Stored Procedures, and then click New Stored Procedure.

On the Query menu, click Specify Values for Template Parameters.

In the Specify Values for Template Parameters dialog box, enter the following values for the parameters shown.

ParameterValueAuthorYour nameCreate DateToday's dateDescriptionReturns employee data.Procedure_nameHumanResources.uspGetEmployeesTest@Param1@LastName@Datatype_For_Param1nvarchar(50)Default_Value_For_Param1NULL@Param2@FirstName@Datatype_For_Param2nvarchar(50)Default_Value_For_Param2NULL

Click OK.

In the Query Editor, replace the SELECT statement with the following statement:

SQLCopy

SELECT FirstName, LastName, Department FROM HumanResources.vEmployeeDepartmentHistory WHERE FirstName = @FirstName AND LastName = @LastName AND EndDate IS NULL;

To test the syntax, on the Query menu, click Parse. If an error message is returned, compare the statements with the information above and correct as needed.

To create the procedure, from the Querymenu, click Execute. The procedure is created as an object in the database.

To see the procedure listed in Object Explorer, right-click Stored Proceduresand select Refresh.

To run the procedure, in Object Explorer, right-click the stored procedure name HumanResources.uspGetEmployeesTestand select Execute Stored Procedure.

In the Execute Procedure window, enter Margheim as the value for the parameter @LastName and enter the value Diane as the value for the parameter @FirstName.


hope u got ur answer...
pls mark it as brainliest.
Similar questions