varchar & nvarchar 字段“在输入很少字符后”,后面的位置不会被空格填充。而是char & nchar 才会这样

解决方案 »

  1.   

    楼上的有道理.
    to windindance(风之舞) :
    SQLServer去掉空格用:Rtrim(),Ltrim()
      

  2.   

    char,nchar是定长字符串,长度不够加空格。如果字段长度不固定,还是最好采用varchar,nvarchar
      

  3.   

    你好象说反了吧?CHAR主要是用在常用字段,修改较多的字段
    Vchar主要是用在较长的字段,而且字段内容并不需要太多改动的地方.
      

  4.   

    *char is Fixed-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000.Storage size is n bytes.
    *varchar is Variable-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000.Storage size is n bytes.
    *nchar is Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size is two times n bytes. 
    *nvarchar is Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. 
    上面这段是从sql server book on_line 中copy的,hope used for you!
      

  5.   

    在sql7中有一个选项,你可以试一下 set ansi_padding off后插入数据,其后空格不会加入到数据中.
      

  6.   

    to firedragoninhell(地獄炎龍)呵呵,我当然是在查了book online之后才来问的,谢谢你:)