Thousand separator insert via ODBC

aip00
Member Posts: 5
I'm having an issue where I'm trying to insert a record to SQL via ODBC. The SQL table field is setup as type 'money'. When I tried to insert this field with a value over a thousand from Axapta, it gave me an error message. It turned out when I specified the field from Axapta, it added a thousand separator in it. So the statement like this:
ustr = 'INSERT INTO SKU_LOC';
ustr += ' (BATCHID, CUSTOMER_ID, LOC_ID, SKU, EVENT_ID, VENDOR_ID_PRIMARY, PRICE_REG_SALE)';
ustr += strfmt(' VALUES (\'%1\', \'%2\', \'%3\', \'%4\', \'%5\', \'%6\', %7), ', batchId, skuTable.CustomerId, skuTable.LocId, skuTable.SKU, skuTable.EventId, skuTable.VendorIdPrimary, skuTable.PriceRegSale);
failed because the skuTable.PriceRegSale adds a ',' (comma) to it. The ODBC sees it as an extra column (and that is exactly what the error message is).
I set the Extended Data Type of this field. thousand separator to 'No'. In Axapta, the form shows no thousand separator.
How can I pass this value without the thousand separator?
ustr = 'INSERT INTO SKU_LOC';
ustr += ' (BATCHID, CUSTOMER_ID, LOC_ID, SKU, EVENT_ID, VENDOR_ID_PRIMARY, PRICE_REG_SALE)';
ustr += strfmt(' VALUES (\'%1\', \'%2\', \'%3\', \'%4\', \'%5\', \'%6\', %7), ', batchId, skuTable.CustomerId, skuTable.LocId, skuTable.SKU, skuTable.EventId, skuTable.VendorIdPrimary, skuTable.PriceRegSale);
failed because the skuTable.PriceRegSale adds a ',' (comma) to it. The ODBC sees it as an extra column (and that is exactly what the error message is).
I set the Extended Data Type of this field. thousand separator to 'No'. In Axapta, the form shows no thousand separator.
How can I pass this value without the thousand separator?
0
Comments
-
Here is the solution.
Add this to convert the value from Axapta in the INSERT statement:
CAST(CONVERT(real, \'%7\', 0) as money)
;where %7 is the field with the thousand separator.
Thanks.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions