How do I expand the auto generated column size? String or binary data would be truncated

3 posts, 0 answers
  1. Chris
    Chris avatar
    19 posts
    Member since:
    Oct 2010

    Posted 24 Nov 2013 Link to this post

    I am auto-generating the DB from code and am getting the following error:

    String or binary data would be truncated

    ... which is due to the string being a bit too long for the underlying SQL.  I would like the column that's created to be nvarchar(max), however that setting seems to only be in the code-first configuration.

    Here is the link I found regarding fluent configuration.

    http://documentation.telerik.com/openaccess-orm/documentation/developers-guide/code-only-mapping/mapping-clr-types-properties-and-associations/advanced-mapping/backend-independent-mapping/fluent-mapping-mapping-clr-advanced-backend-independent-string-properties
  2. Chris
    Chris avatar
    19 posts
    Member since:
    Oct 2010

    Posted 24 Nov 2013 Link to this post

    I found that if I right click on the table, I have the ability to edit the properties of the columns.  I was expecting this to be in properties of the column name itself.
  3. DevCraft banner
  4. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 25 Nov 2013 Link to this post

    Hi Chris,

    I am glad you have resolved the situation.

    As you found out, one of the ways to change the SQL type of the column to nvarchar(max), or any other type, is to use the Table Editor.

    Note that the SQL type can also be set using the SqlType property located in the properties window of the column. Using this approach however, you will have to type the name of the property manually instead of selecting it from a drop-down list.

    Additionally, in case you need to change the SQL type of multiple columns, you can do so by using Model Operations:
    1. Open the Model Operations dialog.
    2. Select Members as the Display Mode. You can filter the displayed columns by their SQL type.
    3. Choose the columns which which type you wish to change.
    4. From the Operation drop-down list, select the Change SQL Type operation.
    5. Click the Execute button.

    I hope this helps. In case you have additional questions, feel free to contact us via our ticketing system or post in our forums again.

    Regards,
    Kristian Nikolov
    Telerik
    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Back to Top