SQLCMD
In reading Ch 11 on Scripts and Batches on page 338, Robert Vieira gave a code example at the bottom of the page with the line...
SET @str = 'SELECT LEFT(CompanyName,' + CAST(@NumberOfLetters AS varchar) + ') AS ShortName FROM Customers'
My question is why do you need to use CAST in this case as it seems to me that when you use the LEFT function, you want an integer number to indicate the number of letters you want to select.
Any ideas on this?
Gary
|