MSSQL能解决按道理 MYSQL也能解决啊 小弟初学者 请多多指教

解决方案 »

  1.   

    不一定,否则大家就不用买MS SQL SERVER了。具体解释一下什么叫 “随机插入中文” ?问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧
        
      

  2.   


    declare @t table(col nvarchar(4))
    insert @t select nchar(cast(19968+rand()*40868 as int))
    insert @t select nchar(cast(19968+rand()*40868 as int))
    insert @t select nchar(cast(19968+rand()*40868 as int))
    select * from @t
    能插入所有漢字範圍包括繁體在 MSSQL下 .
      

  3.   

    倒是有这么个转法: 
    mysql> select cast((conv(cast((19968.0 + rand()*40868) as signed int), 10, 16)) as nchar);
    +-----------------------------------------------------------------------------+
    | cast((conv(cast((19968.0 + rand()*40868) as signed int), 10, 16)) as nchar) |
    +-----------------------------------------------------------------------------+
    | E6D3                                                                        |
    +-----------------------------------------------------------------------------+
    1 row in set (0.00 sec)
      

  4.   

    mysql> select unhex(hex(19968+rand()*40868));
    +--------------------------------+
    | unhex(hex(19968+rand()*40868)) |
    +--------------------------------+
    | 曜                             |
    +--------------------------------+
    1 row in set (0.00 sec)mysql>
      

  5.   

    设计的表如下:create table table1(username varchar(20)
    ,addtime datetime,id int) 创建存储过程如下:
    create PROCEDURE d()   
    BEGIN
    declare i int;
    set i=0;
    while i<1000 do
    insert into table1(addtime,id) values(NOW(),i);
    set i=i+1;
    end while;
    END
    我想让这表随机插入用户名USERNAME  结果没做出来
      

  6.   

    设置你的字符集。http://blog.csdn.net/ACMAIN_CHM/archive/2009/05/12/4174186.aspx
    MySQL 中文显示乱码
      

  7.   

    alter table users character set GBK;  
    这段语句可以把字符集改成中文.
      

  8.   

     alter database users character set utf8;
      

  9.   

    mysql> select unhex(hex(19968+rand()*40868));
    +--------------------------------+
    | unhex(hex(19968+rand()*40868)) |
    +--------------------------------+
    |                                |
    +--------------------------------+
    1 row in set
    还是一片空白
      

  10.   

    mysql> select unhex(hex(19968+rand()*40868));
    +--------------------------------+
    | unhex(hex(19968+rand()*40868)) |
    +--------------------------------+
    | T                             |
    +--------------------------------+
    1 row in set (0.00 sec)mysql> select unhex(hex(19968+rand()*40868));
    +--------------------------------+
    | unhex(hex(19968+rand()*40868)) |
    +--------------------------------+
    | ?                             |
    +--------------------------------+
    1 row in set (0.00 sec)mysql> select unhex(hex(19968+rand()*40868));
    +--------------------------------+
    | unhex(hex(19968+rand()*40868)) |
    +--------------------------------+
    | 扗                             |
    +--------------------------------+
    1 row in set (0.00 sec)有点意思,不过总出问号