MSSQL print shows a value but cannot display value otherwise
Posted on 2011-10-13
Can some one tell why this print commands succeed but fails when an attempt is made to display the values otherwise .
Will show only part of the script for brevity .
Within a loop the information is echo ed to make sure it is passed properly and it appears it is.
But when the same information is included in a set statement it fails
any directions will be appreciated
set @MailSubject = +@@servername +' Drive ' + @drives + ' is low on Disk space '
set @AlertMessage = ' Drive ' + @drive + ' , has ' +@DiskFreeSpace+ ' MB left out of ' +@TotalSize+ ';'
Msg 245, Level 16, State 1, Line 77
Conversion failed when converting the varchar value ' Drive L , has ' to data type int.