نمایش نتایج 1 تا 1 از 1

نام تاپیک: بهترین انتخاب برای ستون های از نوع string استفاده از varchar یا nvarchar

  1. #1

    Lightbulb بهترین انتخاب برای ستون های از نوع string استفاده از varchar یا nvarchar

    سلام به همه

    - هر دو برای ذخیره داده به صورت رشته با طول متغییر استفاده می شه

    - nvarchar برای ذخیره رشته های unicode استفاده می شه که دو برابر نسبت به نوع varchar فضا می گیره

    - اگه از codepage استفاده کنی و اون code page توسط سیستم عامل شما و sql ساپورت بشه- مثلا برای زبان فارسی و یا عربی از code page 1256 - می تونی از varchar هم استفاده کنی که البته varchar فضای کمتری جهت ذخیره کردن دیتا نسبت به nvarchar نیاز داره

    اما نظر یه کاربر تو این سایت توجه منو جلب کرد که پیشنهاد می کنه اگه از ASCII هم استفاده می کنید برای فیلدهاتون از unicode استفاده کنید و ... بقیه شو خودتون بخونید و نظر تون رو بگید.




    An nvarchar column can store any Unicode data. A varchar column is restricted to an 8-bit codepage. Some people think that varchar should be used because it takes up less space. I believe this is not the correct answer. Codepage incompatabilities are a pain, and Unicode is the cure for codepage problems. With cheap disk and memory nowadays, there is really no reason to waste time mucking around with code pages anymore.
    All modern operating systems and development platforms use Unicode internally. By using nvarchar rather than varchar, you can avoid doing encoding conversions every time you read from or write to the database. Conversions take time, and are prone to errors. And recovery from conversion errors is a non-trivial problem.

    If you are interfacing with an application that uses only ASCII, I would still recommend using Unicode in the database. The OS and database collation algorithms will work better with Unicode. Unicode avoids conversion problems when interfacing with other systems. And you will be preparing for the future. And you can always validate that your data is restricted to 7-bit ASCII for whatever legacy system you're having to maintain, even while enjoying some of the benifits of full Unicode storage
    آخرین ویرایش به وسیله saeid1389 : جمعه 04 شهریور 1390 در 00:54 صبح

برچسب های این تاپیک

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •