# .NET DA LINQ truncates looong field names

**URL:** https://talk.remobjects.com/t/net-da-linq-truncates-looong-field-names/16108
**Category:** Data Abstract
**Tags:** net, oxygene, linq
**Created:** [April 10, 2018, 12:43pm UTC](https://talk.remobjects.com/t/net-da-linq-truncates-looong-field-names/16108 "2018-04-10T12:43:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![birger](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@birger](https://talk.remobjects.com/u/birger)
#### Post date: [April 10, 2018, 12:43pm UTC](https://talk.remobjects.com/t/net-da-linq-truncates-looong-field-names/16108/1 "2018-04-10T12:43:03Z")

</div>

When I use LINQ with an SQL statement with long fieldnames, the query execution fails, because the SQL generated by DA LINQ truncates the field names.

Here is SQL example:

```
select
"D19" as "ImportanceGettingHelpWithCrimeProblemsRate",
"B27" as "ImportanceOfAdviseOfWorkingRelatedTroubleRate",
"C74" as "ImportanceOfTreatmentBecauseOfAlcoholMisuseRate"
from "Table"
where "FieldA" = :FieldA

```

Debug info from the FirebirdSql.Data.FirebirdClient:

```
SELECT 
    "t0"."ImportanceGettingHelpWithCrimeP", "t0"."ImportanceOfAdviseOfWorkingRela", 
    "t0"."ImportanceOfTreatmentBecauseOfA" 
FROM (select
    "D19" as "ImportanceGettingHelpWithCrimeProblemsRate",
    "B27" as "ImportanceOfAdviseOfWorkingRelatedTroubleRate",
    "C74" as "ImportanceOfTreatmentBecauseOfAlcoholMisuseRate"
    from "Table"
    where "FieldA" = @FieldA) "t0"

```

Here is how it is used in code:

```
var someThing, someThingElse: String;
var tbl := self.LinqDataAdapter.GetTable<Table>([new DataParameter('FieldA',2)]).ToList;
try
  var rec := tbl.First;
  someThing := rec.FieldSomeThing;
  someThingElse := rec.FieldSomeThingElse;
except
  someThing := '';
  someThingElse := '';
end;

```

Is it not possible to have such long field names in LINQ?

Trying to avoid having to rewrite SQL code from Delphi project.

---

<div class="post-metadata">

### Author: ![birger](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@birger](https://talk.remobjects.com/u/birger)
#### Post date: [April 10, 2018, 1:47pm UTC](https://talk.remobjects.com/t/net-da-linq-truncates-looong-field-names/16108/2 "2018-04-10T13:47:17Z")

</div>

I have checked the DA Schema - and there it is truncated as well - in the field mapping section.  
I will try and regenerate the field mappings and see if it helps.

---

<div class="post-metadata">

### Author: ![birger](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@birger](https://talk.remobjects.com/u/birger)
#### Post date: [April 13, 2018, 7:58am UTC](https://talk.remobjects.com/t/net-da-linq-truncates-looong-field-names/16108/3 "2018-04-13T07:58:00Z")

</div>

It helped to regenerate in the DA Schema. I made no changes to the SQL and it worked fine.

---

<div class="post-metadata">

### Author: ![antonk](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@antonk](https://talk.remobjects.com/u/antonk)
#### Post date: [April 13, 2018, 9:27am UTC](https://talk.remobjects.com/t/net-da-linq-truncates-looong-field-names/16108/4 "2018-04-13T09:27:45Z")

</div>

In general there are no field name length restrictions (double-checked it).

However it could be that it was some kind of a DB driver limitation (or bug) that resulted in truncated field names.

Note that according to this issue [http://tracker.firebirdsql.org/browse/CORE-749](http://tracker.firebirdsql.org/browse/CORE-749) identifier length in FirebirdSQL is limited on the database core level.
