afdaf67cad4210eb8a4bfb92538e5619e2c97014
API/CodeSamples/Changing-Decimal-Type-Precision-number-number-Appearance-star-Adding-Custom-Formats.md
| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | + |
|
| 2 | + |
|
| 3 | + |
|
| 4 | +#Changing Decimal Type Precision |
|
| 5 | + |
|
| 6 | +##About |
|
| 7 | + |
|
| 8 | +Below is the SQL sample to create a View with 1 million records using the Northwind example database. This query can be used to load test your application with before you send it out to production. |
|
| 9 | + |
|
| 10 | + |
|
| 11 | +## What To Change |
|
| 12 | + |
|
| 13 | + |
|
| 14 | + |
|
| 15 | +DECIMAL(18,6) to NUMERIC(22,8) |
|
| 16 | +```c# |
|
| 17 | +List<KeyValuePair<string, string>> typeOverrides = AdHocContext.Driver.NativeTypesOverrides; |
|
| 18 | +for (int i = 0; i < typeOverrides.Count; i++) |
|
| 19 | + if (typeOverrides[i].Key == "Decimal") |
|
| 20 | + { |
|
| 21 | + typeOverrides[i] = new KeyValuePair<string, string>(typeOverrides[i].Key, "NUMERIC(22,8)"); |
|
| 22 | + break; |
|
| 23 | + } |
|
| 24 | +AdHocContext.Driver.NativeTypesOverrides = typeOverrides; |
|
| 25 | + |
|
| 26 | +``` |
|
| ... | ... | \ No newline at end of file |