Basit Khan

Basit Khan

  • NA
  • 336
  • 120.8k

Variable with Concatenation in SQL

Aug 19 2015 4:45 AM
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)