https://kotlinlang.org logo
#exposed
Title
# exposed
e

erica

11/12/2018, 5:14 PM
is there any way to do something like
varchar(MAX)
for table definition? I need to insert more than 8000 chars. I’m using DSL and SQL.
c

christophsturm

11/12/2018, 5:24 PM
what about
text("bla")
?
e

erica

11/12/2018, 5:34 PM
yea that is an option but as far as I remember,
text
is planned to be deprecated in the future version of SQL…
c

christophsturm

11/12/2018, 5:38 PM
well text is for long text blocks.
t

tapac

11/13/2018, 6:37 AM
@erica, never heard about a
text
deprecation, could you share a some links? Also, you may create your own column type:
Copy code
class VarCharMaxColumnType(collate: String? = null): StringColumnType(collate)  {
    override fun sqlType(): String = buildString {
        append("VARCHAR(MAX)")

        if (collate != null) {
            append(" COLLATE $collate")
        }
    }
}

fun varcharMax(name: String, collate: String? = null): Column<String> = registerColumn(name, VarCharMaxColumnType(collate))
e

erica

11/13/2018, 4:46 PM
@tapac thanks for the idea, that should do the trick. I was looking at this doc : https://docs.microsoft.com/en-us/sql/t-sql/data-types/ntext-text-and-image-transact-sql?view=sql-server-2017
c

christophsturm

11/13/2018, 4:54 PM
interesting. that seems to be sql server specific though
17 Views