i'm trying to make a string from table values, along with some text to make it more readable.
The only problem i'm having. Is that i can't get the SELECT statement to work inside my CONCAT. It's been bugging me for quite some time now, and i would appreciate any feedback on what i'm doing wrong or if there is another way to do this.
My SQL script:
CREATE PROCEDURE dbo.spDepartment_UpdateDepartment
@UserId INT, @Id INT, @Name VARCHAR(128)
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO EventLog(Content)
VALUES(CONCAT('User: ', @UserId, ', has updated a department name from: ', **SELECT Name FROM Department WHERE Id = @Id**, ' to: ', @Name)
END