Setting dataset field types for custom datasets

Randall Berg -

Our database tries to assign types automatically, however sometimes they can be wrong.  If you're building a custom dataset and finding that the fields types are being set erroneously, here are a few commands that you can add in the field to force a specific field type

 

MS-SQL

Number:

cast( fieldname as numeric) as 'fieldname'

Text

cast( fieldname as varchar) as 'fieldname'

Date

cast( fieldname as datetime) as 'fieldname'

more explanation and field types here if necessary: http://msdn.microsoft.com/en-us/library/ms187928.aspx

 

 

mySQL

Number

cast( fieldname as decimal) as 'fieldname'

Text

cast( fieldname as varchar) as 'fieldname'

Date

cast( fieldname as datetime) as 'fieldname'

more explanation and field types here if necessary: http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

 

 

If you still need more help with this, do not hesitate to contact us at support and we'd be glad to assist!

Have more questions? Submit a request

Comments

  • Avatar
    Kris Headrick

    The Text for MySQL should be cast as char(), unsigned is used for numbers

  • Avatar
    Randall Berg

    Hi Kris,

    Unsigned works for our instance as it sets is as a string, but I'm actually going to update this document as we can now set things to varchar.

    Sorry for not doing so earlier!

Powered by Zendesk