2
Answers

Variable with Concatenation in SQL

basit khan

basit khan

9y
436
1
Dear All,
 
 I declare three variable in below trigger, now i want to Concatenation with @AllVar.
 
When i do Concatenation got error Incorrect syntax near '+'. Why this?
 
 
create TRIGGER <TriggerName>
ON [dbo].<TableName>
FOR INSERT
AS
BEGIN
DECLARE @us_email varchar(500);
DECLARE @CallNo varchar(500);
DECLARE @AllVar varchar(500);
SET NOCOUNT ON;
IF EXISTS (SELECT * FROM inserted)
BEGIN
SELECT @us_email = EmailAddress
FROM inserted i,
Users u
SELECT @CallNo ='Notification :Call Number is :' + SPACE(1)+ CallNumber
FROM inserted
@AllVar='The Call Number is '+ @CallNo + ' and some Text'
END
END
GO
 Thanks
Basit 
Answers (2)