I have a table that stores email data. The challenge that I have is that some of the column names use MSSQL Reserved Words such as To and FROM.
I've place brackets around the column names and my Query works fine in Query Designer, but the challenge is I'll be calling it from ASP.Net. Bracket syntax in ASP.Net indicate it should inject data in place of the brackets.
To avoid all of this I want to create a View. How do I change the column names in the View to avoid Reserved Words?
SELECT PortalID, [To], [From], Subject, Body, CreatedOnDate, CreatedByUserID
FROM dbo.CoreMessaging_Messages
create view v (c1, c2, ...) as select ...[To] AS newname