Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise Design Integration Forum Data type
    • Sign In

    • State Not Answered
    • Replies 4 replies
    • Subscribers 62 subscribers
    • Views 744 views
    • Users 0 members are here

    Data type

    Luc Poulin
    Offline Luc Poulin over 1 year ago

    Hello Community

    Looking at a detail description of each Data Type we can choose when creating Attributes.

    I wanted to better understand long terms impact when selecting one versus another and the difference between them.

    I also see NatIve Data Type as an option??

    Thank you

    • Sign in to reply
    • Cancel
    Parents
    • Kevin van Haaren
      0 Offline Kevin van Haaren Tue, Jul 12 2022 11:06 AM

      The data types are specific to the database server you are using. If you are using SQL Server as your database most of the data types are here:

      https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver16

      there is also a good list here:

      https://www.w3schools.com/sql/sql_datatypes.asp

      Turning on native datatypes allows you to type in one of the data types for your database server that isn't in the drop down list. I would avoid this until you are very, very, sure of what you are doing (I've still never done it)

      Generally I use 3 types:

      • NVARCHAR - Text
      • INT - "small" numbers => max/min of +/- 2 billion
      • BIGINT - "big numbers" => max/min of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

      Occasionally i use CHAR with a length of 1 to store Y/N values, but the logic on that gets hard, i probably should start using BOOLEAN for those types (that's a native type though)

      SQL Server has a maximum row length of 8000 bytes so you want to pick INT (4 bytes/number) and BIGINT (8 bytes/number) for the appropriate data you're using. Undersizing is hard to fix. I generally only need BIGINT when storing file sizes in bytes or time stamps in milliseconds, other engineering applications may have more use cases.

      the NVARCHAR and NCHAR are the datatypes for unicode strings. I prefer this as it handles a much wider range of characters correctly (including emoji) better. Setting the length of NVARCHAR is tricky. I usually estimate the biggest string I plan on storing and double that. Generally I pick 25, 50 or 100 unless it's a generic "comments" or "notes" field in which case I'll usually go to 200 or even 500. People names and Company Names I think I usually pick 50. Not sure if I've gotten burned on that yet. email typically 50 but I may start using 100, there are some incredibly long email addresses.

      Here's microsoft's info on NCHAR and NVARCHAR.

      docs.microsoft.com/.../nchar-and-nvarchar-transact-sql

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Luc Poulin
      0 Offline Luc Poulin Wed, Jul 13 2022 7:58 AM in reply to Kevin van Haaren

      Thank you Kevin

      Much appreciate

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Reply
    • Luc Poulin
      0 Offline Luc Poulin Wed, Jul 13 2022 7:58 AM in reply to Kevin van Haaren

      Thank you Kevin

      Much appreciate

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Children
    No Data

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies