Link to home
Start Free TrialLog in
Avatar of marrowyung
marrowyung

asked on

passing server name as parameter in MS SQL

Dear all,

right now I am going to pass server name as the parameter as the SP:
       
       
DECLARE @servername varchar(100);
         
set @servername= CAST((select SERVERPROPERTY ('ServerName') ) as varchar (100));
               
EXEC master.dbo.sp_drivespace_alerts
        @threshold = 204800, 
        @from = ' yyy',
        @subject = 'Low Disk Space Alerts -' + @servername + ' ' ,
        @to = ' xxx'

Open in new window


it complains like:

Incorrect syntax near '+'.
ASKER CERTIFIED SOLUTION
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marrowyung
marrowyung

ASKER

it seems working now.
Have you tried my solution? I have declared the variable as @subj, in order to be unique.

Giannis
yes. basically both solution give the same result after I read that.