Procedure: A Simple Stored Procedure |
|
Script |
This is a simple stored procedure that creates email address for employees by just appending the first letter of the first name to the last name, all in lowercase: |
-- ============================================= -- Procedure: CreateEmailAddress -- Creates an Email Address for each employee -- ============================================= IF EXISTS (SELECT name FROM sysobjects WHERE name = N'CreateEmailAddress' AND type = 'P') DROP PROCEDURE CreateEmailAddress GO CREATE PROCEDURE CreateEmailAddress AS UPDATE Employees SET EmailAddress = LOWER(LastName) + LOWER(LEFT(FirstName, 1)) + '@supermarket.com' FROM Employees GO
|
||
Home | Copyright © 2004-2010 FunctionX, Inc. | |
|