SQL Server ֪ʶ»ýÀÛ
varcharºÍnvarcharÈçºÎÑ¡Ôñ£º
varcharÔÚSQL ServerÖÐÊDzÉÓõ¥×Ö½ÚÀ´´æ´¢Êý¾ÝµÄ£¬nvarcharÊÇʹÓÃUnicoÀ´´æ´¢Êý¾ÝµÄ¡£ÖÐÎÄ×Ö·û´æ´¢µ½SQL ServerÖлᱣ´æΪÁ½¸ö×Ö½Ú£¨Ò»°ã²ÉÓÃUnico±àÂ룩£¬Ó¢ÎÄ×Ö·û±£´æµ½Êý¾Ý¿âÖУ¬Èç¹û×ֶεÄÀàÐÍΪvarchar£¬ÔòÖ»»áÕ¼ÓÃÒ»¸ö×Ö½Ú£¬¶øÈç¹û×ֶεÄÀàÐÍΪnvarchar£¬Ôò»áÕ¼ÓÃÁ½¸ö×Ö½Ú¡£ËäȻʹÓÃnvarchar´æ´¢Ó¢ÎÄ×Ö·û»áÔö´óÒ»±¶µÄ´æ´¢¿Õ¼ä£¬µ«Éè¼ÆµÄʱºòÓ¦¸Ã¾¡Á¿Ê¹ÓÃnvarcharÀ´´æ´¢Êý¾Ý¡£Ö»ÓÐÔÚÄãÈ·±£¸Ã×ֶβ»»á±£´æÖÐÎĵÄʱºò£¬²Å²ÉÓÃvarcharÀ´´æ´¢¡£
Ïà¹ØÎĵµ£º
×÷Ϊһ¸öB/S¿ª·¢Õߣ¬»ò¶à»òÉÙ¶¼µÃºÍÊý¾Ý¿â´ò½»µÀ£¬¶ø¶ÔÊý¾Ý¿âµÄ²Ù×÷¹é¸ùµ½µ×¶¼ÊÇqueryÓï¾ä£¬ËùÓе½×îºó¶¼ÊÇΪÁ˲éѯ£¬ÄÇô²é¿´sqlÐÔÄÜÓÖ³ÉÁËÎÒÃÇ¿ª·¢ÖеÄÒ»¼þȤÊ¡£ÏÂÃæ¼òµ¥½éÉÜÏÂsql_traceµÄʹÓãº
alter session set sql_trace =true ;--´ò¿ªsql_trace
select * from (select * from t order by id) where rownum <= ......
SQL> var v_str varchar2(100);
SQL> exec :v_str:=',id1,id11,id101,';
PL/SQL procedure successfully completed.
SQL> select :v_str a,replace(:v_str,',','') b
2 ,substr(:v_str,instr(:v_str,',',1,rownum)+1,
3 instr(:v_str,',',1,rownum+1)-ins ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom× ......
»¹ÊÇһתÌû£¬×ܽáµÄ²»´í£¬´ó¼Ò½è¼ø¡£
ÔÍøÖ·£º
http://database.ctocio.com.cn/222/9068222.shtml
1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
¡¡¡¡4¡¢ÄÚ´æ²»×ã
¡¡¡¡5¡¢ÍøÂçËÙ¶ÈÂý
¡¡¡¡6¡¢²éѯ³ö ......
²éѯËÙ¶ÈÂýµÄÔÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ
1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
3¡¢Ã»Óд´ ......