Calling shared function EntriesController.GetEntryByTitle generates the following error:
"Object reference not set to an instance of an object."
SQL Trace captured the following SQL string:
SELECT * FROM (SELECT e.*, CAST (CASE WHEN e.LockedUntil > GETDATE() THEN 1 ELSE 0 END AS BIT) AS IsLocked, ext.ControlToLoad, ext.Custom, ext.DownloadUrl, ext.EntryTypes, ext.Icon16, ext.Icon32, ext.IsPrivate, ext.MimeType, ext.ResourceFile, ext.SettingsControl, ext.ViewByDefault, CAST(CASE WHEN (PATINDEX('Collection%',e.EntryType)>0) THEN 1 ELSE 0 END AS BIT) AS IsCollection, ISNULL((SELECT [Text] FROM dbo.DMX_LongTexts WHERE TypeKey='ENT' AND SubTypeKey='REMARKS' AND ObjectId=e.EntryId AND Locale='en-US'), (SELECT [Text] FROM dbo.DMX_LongTexts WHERE TypeKey='ENT' AND SubTypeKey='REMARKS' AND ObjectId=e.EntryId AND Locale='')) Remarks, ISNULL((SELECT [Text] FROM dbo.DMX_ShortTexts WHERE TypeKey='ENT' AND SubTypeKey='TITLE' AND ObjectId=e.EntryId AND Locale='en-US'), (SELECT [Text] FROM dbo.DMX_ShortTexts WHERE TypeKey='ENT' AND SubTypeKey='TITLE' AND ObjectId=e.EntryId AND Locale='')) Title FROM dbo.DMX_Entries e INNER JOIN dbo.DMX_Extensions ext ON e.EntryType=ext.ExtensionKey WHERE e.PortalId = 0) AS return WHERE Title = 'ROOT_0000000005'
Executing this command in SQL Management Studio returns the following error message:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'return
return is a reserved keyword. Wrapping it in square brackets (e.g. [return]) solves the problem.
The SQL Server used for this website is SQL Server 2008 Standard.'