---
title: "ORM Basics Adjusting SQL Data Types"
slug: "orm-basics-adjusting-sql-data-types"
description: "This document shows how to apply overrides to the ORMField attribute to set what database type is used for storing a field. The document includes two examples of code for overriding text fields in Visual Studio."
updated: 2024-07-25T19:23:49Z
published: 2024-07-25T19:23:49Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ORM Basics Adjusting SQL Data Types

## Overview

Using overrides to the ORMField attribute, developers can set what database type to store in a field.

Below is a table displaying the typeof() ORM Field Convertors.

| ORM Field Convertor | Decisions Type | Store as SQL Type |
| --- | --- | --- |
| EnumFieldConverter | Enum | String |
| KeyFieldConverter | PK | Primary Key |
| StringArrayFieldConverter | String[] | Serialized Text |
| TextFieldCoverter | String | nvarchar(max) |
| ORMZmlSerializedFieldConverter | XML | XML |
| ORMDataPairFieldConverter | DataPair | Serialized Text |
| ORMBinaryFieldConverter | Binary | Binary |
| ORMWritableFieldConverter | Generic Serialized Object Graph | Binary |
| FixedLengthStringFieldConverter | String | varchar(length) |
| EncryptedConverter | ANy | Encrypted Binary |
| BaseDateTimeConverter | DateTime | DateTime |
| BaseDateConverter | Date | DateTime |
| TimeFieldConverter | Time | Time |
| TimeSpanORMFieldConverter | TimeSpan | Long |

## Example

The code snippet below demonstrates how to override a long text field. This field will become a nvarchar(max) field in SQL.

```csharp
[ORMField(typeof(TextFieldConverter))]
[DataMember]
[WritableValue]
public string Description { get; set; }
```

Below is an example showing how to limit the text length of a field. This field will become a nvarchar(15) field in SQL.

```csharp
[ORMField("phone_number", 15, typeof(FixedLengthStringFieldConverter))]
[DataMember]
[WritableValue]
public string PhoneNumber { get; set; }
```
