Incorrect syntax near '+'. in SQL Server 2005
Posted on 2007-04-03
I have a stored procedure that works in SQL Server 2000. I created a script to update the stored procedure, and it worked fine. Now I have converted to SQL Server 2005 and am getting an error when I run the script. The error I get is
Incorrect syntax near '+'.
Here is a snippet from the script. The error points to the last line of this snippet.
DECLARE @OrganizationShortName varchar(26)
SELECT @OrganizationShortName = (SELECT [Organization Short Name] From [dbo].[Organization Info] WHERE RecID = 1)
DECLARE @FileContents VARCHAR(8000)
CREATE TABLE #tempHTML (HTMLTEXT VARCHAR(8000))
BULK INSERT #tempHTML FROM 'D:\Inetpub\wwwroot\APER Survey Module\'+@OrganizationShortName+'\Email Docs\'+@OrganizationShortName+' Reminder After Deadline Email.html'
Why did this work in 2000 but will not work in 2005, and how do I modify the code to get it to work?