Write a script to create a stored procedure in T-SQL.?
-
Write a script to create a stored procedure in T-SQL. The stored procedure should update a row in the Employee table provided below. It should accept an Employee's Name and EmailAddress and PositionID. Using the Name and EmailAddress, the stored procedure should update that employee's position. Employee Name varchar(50) EmailAddress varchar(250) Birthdate datetime Startdate datetime Enddate datetime PositionID int DepartmentID int Department DepartmentID int Name varchar(50) FoundingDate datetime Position PositionID int Name varchar(50) CreationDate datetime
-
Answer:
CREATE PROCEDURE EmployeeUpdate @Name varchar(50), @EmailAddress varchar(250), @PositionID int AS BEGIN UPDATE Employee SET PositionID = @PositionID WHERE [Name] = @Name AND EmailAddress = @EmailAddress END The preceding code does not have any error handling and assumes that Name and EmailAddress will always exist, so be sure and check for that in your program before running the procedure.
jordan at Yahoo! Answers Visit the source
Related Q & A:
- Can I create a second filestream container on an existing SQL Server 2008 database without going offline?Best solution by Database Administrators
- Why can't I create a screen name?Best solution by answers.yahoo.com
- Is international adoption a simple procedure?Best solution by Yahoo! Answers
- How to write a persuasive letter to a bank?Best solution by wikihow.com
- Why can't I create a myyearbook account?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.