I am working on a part where i use Store Procedures to Insert rows into a table (adding a new employee, to be precise).. The thing is, I am auto incrementing the ID field and there is a field where the picture name will be stored.. I am having problem trying to save the picture name same with the ID..Here is my stored procedure:
Expand|Select|Wrap|Line Numbers
- -- My Employees table has three fields (ID, name, picture)
- CREATE PROCEDURE insertEmployeeDetails(@name varchar(50), @salaryApplied DateTime, @salaryLevel int)
- AS
- INSERT INTO Employees VALUES (@name, convert(varchar, @@IDENTITY) + '.jpg');
- SET @id = @@IDENTITY
- INSERT INTO Salaries VALUES (@id, @salaryApplied, @salaryLevel);