Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a column with varchar(max) rather than varchar(8000)

How can I create a column in a table and specify it as varchar(max) when using servicestack ormlite?

Currently I execute some sql after the table create to get what I want. I've seen the StringLength attribute but was wondering if there's a nicer way of doing it?

Something like

StringLength(Sql.VarcharMax)

Thanks

like image 345
Antony Denyer Avatar asked Jun 20 '13 11:06

Antony Denyer


1 Answers

Worked around the issue by doing the following

 if (!db.TableExists(typeof(Entity).Name))
 {
   db.CreateTableIfNotExists<Entity>();
   db.ExecuteSql("ALTER TABLE Entity ALTER COLUMN Column VARCHAR(MAX)");
 }
like image 178
Antony Denyer Avatar answered Oct 22 '22 12:10

Antony Denyer