I'm a beginner with SQL Server 2005 and trying to complete a project with the following question, can someone please help?
Use AdventureWorks database and HumanResources.Department table.
Create a stored procedure called spDepartmentAddUpdate. This procedure accepts two parameters: Name, and GroupName. The data types are VarChar(50), and VarChar(50) respectively. Define logic in this procedure to check for an existing Department record with the same Name. If the department record exists, update the GroupName and ModifiedDate. Otherwise, insert a new department record.
- Execute your stored procedure to show that the insert logic works.
- Execute your stored procedure to show that the update logic works.
1. DepartmentID is an identity column.
2. You may use GETDATE() to insert or update the modified date.
Thanks in advance!