Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Inserting into tables with columns named after sql keywords #35

lukencode opened this Issue · 4 comments

3 participants


I had some trouble inserting into a table with a column called "User" which I believe is and sql keyword. Could probably fix it by delimiting column names eg. "[User]".


Luke, do you not just add it yourself in Massive? While I am likely more opinionated with my SQL and don't use keywords for tables/columns for a variety of reasons, it seems like you could just hop in your code and make the change yourself:
I do tons of changes to Massive to get it to fit what I want all the time. Part of the reason I like it so much. It's like my own simple ORM silly putty.

You can look for these types of lines in the code:
var stub = "INSERT INTO {0} \r\n VALUES ({2})";

sbKeys.AppendFormat("{0} = @{1}, \r\n", item.Key, counter.ToString());

And put the brackets in yourself. I do it on a variety of them because I'm "slightly" particular about how my SQL looks.


Yeah I would add it if I were using massive at the moment. It was something I encountered when just trying it out and thought I'd add the issue incase anyone else runs into the same thing.


If there is someone still having issues with this, you can resolve it by defining your classes/queries like:

public class UglySchemaTable  : DynamicModel
    public UglySchemaTable()
        : base("CoolAppDb")
        PrimaryKeyField = "[My bad PK Column]";
        TableName = "[dbo].[UglySchemaTable]";

and while doing a query:

var table = new UglySchemaTable();
var barfing = table.All(where: "[doing it wrong] = @0", args: "me");
return barfing ;
@robconery robconery closed this

Delimits went in the other day - cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.