如题所述
ntextï¼
å¯åé¿åº¦ Unicode æ°æ®çæ大é¿åº¦ä¸º 230 - 1 (1,073,741,823) 个å符ãåå¨å¤§å°æ¯æè¾å ¥å符个æ°ç两åï¼ä»¥åè为åä½ï¼ãntext å¨ SQL-92 ä¸çåä¹è¯æ¯ national textã ntextä¸åæ°æ®æ¯æååèåç ï¼æ¾ç¤ºä¸äºNTEXTæ¢ä¸ä¸recordsetæå¼æ¹å¼å°±è¡äº
ntextåtextçåºå«ï¼
ntextåtextä¸æ ·ç¨æ¥ä¿å大éçæåæ°æ®ï¼ä¸è¿textç¨ååèä¿åæ°æ® ï¼ntextåºå®ç¨ååèä¿åæ°æ®. ntextä¿åçæ¯Uncodeçå符 ï¼ ntextæ¯æè·¨è¯è¨å¹³å°ã
textï¼ æå¡å¨ä»£ç 页ä¸çå¯åé¿åº¦é Unicode æ°æ®çæ大é¿åº¦ä¸º 231-1 (2,147,483,647) 个å符ãå½æå¡å¨ä»£ç 页使ç¨ååèå符æ¶ï¼åå¨éä»æ¯ 2,147,483,647 åèãåå¨å¤§å°å¯è½å°äº 2,147,483,647 åèï¼åå³äºå符串ï¼ã
charãvarcharãtextåncharãnvarcharãntextçåºå«ï¼
1ãCHARãCHARåå¨å®é¿æ°æ®å¾æ¹ä¾¿ï¼CHARå段ä¸çç´¢å¼æç级é«ï¼æ¯å¦å®ä¹char(10)ï¼é£ä¹ä¸è®ºä½ åå¨çæ°æ®æ¯å¦è¾¾å°äº10个åèï¼é½è¦å å»10个åèç空é´,ä¸è¶³çèªå¨ç¨ç©ºæ ¼å¡«å ã
2ãVARCHARãåå¨åé¿æ°æ®ï¼ä½åå¨æç没æCHARé«ãå¦æä¸ä¸ªå段å¯è½çå¼æ¯ä¸åºå®é¿åº¦çï¼æ们åªç¥éå®ä¸å¯è½è¶ è¿10个å符ï¼æå®å®ä¹ä¸º VARCHAR(10)æ¯æåç®çãVARCHARç±»åçå®é é¿åº¦æ¯å®çå¼çå®é é¿åº¦+1ã为ä»ä¹â+1âå¢ï¼è¿ä¸ä¸ªåèç¨äºä¿åå®é 使ç¨äºå¤å¤§çé¿åº¦ãä»ç©ºé´ä¸èèï¼ç¨varcharåéï¼ä»æçä¸èèï¼ç¨charåéï¼å ³é®æ¯æ ¹æ®å®é æ åµæ¾å°æè¡¡ç¹ã
3ãTEXTãtextåå¨å¯åé¿åº¦çéUnicodeæ°æ®ï¼æ大é¿åº¦ä¸º2^31-1(2,147,483,647)个å符ã
4ãNCHARãNVARCHARãNTEXTãè¿ä¸ç§ä»ååä¸çæ¯åé¢ä¸ç§å¤äºä¸ªâNâãå®è¡¨ç¤ºåå¨çæ¯Unicodeæ°æ®ç±»åçå符ãæ们ç¥éå符ä¸ï¼è±æå符åªéè¦ä¸ä¸ªåèåå¨å°±è¶³å¤äºï¼ä½æ±åä¼å¤ï¼éè¦ä¸¤ä¸ªåèåå¨ï¼è±æä¸æ±ååæ¶åå¨æ¶å®¹æé ææ··ä¹±ï¼Unicodeå符éå°±æ¯ä¸ºäºè§£å³å符éè¿ç§ä¸å ¼å®¹çé®é¢è产ççï¼å®ææçå符é½ç¨ä¸¤ä¸ªåè表示ï¼å³è±æå符ä¹æ¯ç¨ä¸¤ä¸ªåè表示ãncharãnvarcharçé¿åº¦æ¯å¨1å°4000ä¹é´ãåcharãvarcharæ¯è¾èµ·æ¥ï¼ncharãnvarcharåæå¤åå¨4000个å符ï¼ä¸è®ºæ¯è±æè¿æ¯æ±åï¼ècharãvarcharæå¤è½åå¨8000个è±æï¼4000个æ±åãå¯ä»¥çåºä½¿ç¨ncharãnvarcharæ°æ®ç±»åæ¶ä¸ç¨æ å¿è¾å ¥çå符æ¯è±æè¿æ¯æ±åï¼è¾ä¸ºæ¹ä¾¿ï¼ä½å¨åå¨è±ææ¶æ°éä¸æäºæ失ã
å¯åé¿åº¦ Unicode æ°æ®çæ大é¿åº¦ä¸º 230 - 1 (1,073,741,823) 个å符ãåå¨å¤§å°æ¯æè¾å ¥å符个æ°ç两åï¼ä»¥åè为åä½ï¼ãntext å¨ SQL-92 ä¸çåä¹è¯æ¯ national textã ntextä¸åæ°æ®æ¯æååèåç ï¼æ¾ç¤ºä¸äºNTEXTæ¢ä¸ä¸recordsetæå¼æ¹å¼å°±è¡äº
ntextåtextçåºå«ï¼
ntextåtextä¸æ ·ç¨æ¥ä¿å大éçæåæ°æ®ï¼ä¸è¿textç¨ååèä¿åæ°æ® ï¼ntextåºå®ç¨ååèä¿åæ°æ®. ntextä¿åçæ¯Uncodeçå符 ï¼ ntextæ¯æè·¨è¯è¨å¹³å°ã
textï¼ æå¡å¨ä»£ç 页ä¸çå¯åé¿åº¦é Unicode æ°æ®çæ大é¿åº¦ä¸º 231-1 (2,147,483,647) 个å符ãå½æå¡å¨ä»£ç 页使ç¨ååèå符æ¶ï¼åå¨éä»æ¯ 2,147,483,647 åèãåå¨å¤§å°å¯è½å°äº 2,147,483,647 åèï¼åå³äºå符串ï¼ã
charãvarcharãtextåncharãnvarcharãntextçåºå«ï¼
1ãCHARãCHARåå¨å®é¿æ°æ®å¾æ¹ä¾¿ï¼CHARå段ä¸çç´¢å¼æç级é«ï¼æ¯å¦å®ä¹char(10)ï¼é£ä¹ä¸è®ºä½ åå¨çæ°æ®æ¯å¦è¾¾å°äº10个åèï¼é½è¦å å»10个åèç空é´,ä¸è¶³çèªå¨ç¨ç©ºæ ¼å¡«å ã
2ãVARCHARãåå¨åé¿æ°æ®ï¼ä½åå¨æç没æCHARé«ãå¦æä¸ä¸ªå段å¯è½çå¼æ¯ä¸åºå®é¿åº¦çï¼æ们åªç¥éå®ä¸å¯è½è¶ è¿10个å符ï¼æå®å®ä¹ä¸º VARCHAR(10)æ¯æåç®çãVARCHARç±»åçå®é é¿åº¦æ¯å®çå¼çå®é é¿åº¦+1ã为ä»ä¹â+1âå¢ï¼è¿ä¸ä¸ªåèç¨äºä¿åå®é 使ç¨äºå¤å¤§çé¿åº¦ãä»ç©ºé´ä¸èèï¼ç¨varcharåéï¼ä»æçä¸èèï¼ç¨charåéï¼å ³é®æ¯æ ¹æ®å®é æ åµæ¾å°æè¡¡ç¹ã
3ãTEXTãtextåå¨å¯åé¿åº¦çéUnicodeæ°æ®ï¼æ大é¿åº¦ä¸º2^31-1(2,147,483,647)个å符ã
4ãNCHARãNVARCHARãNTEXTãè¿ä¸ç§ä»ååä¸çæ¯åé¢ä¸ç§å¤äºä¸ªâNâãå®è¡¨ç¤ºåå¨çæ¯Unicodeæ°æ®ç±»åçå符ãæ们ç¥éå符ä¸ï¼è±æå符åªéè¦ä¸ä¸ªåèåå¨å°±è¶³å¤äºï¼ä½æ±åä¼å¤ï¼éè¦ä¸¤ä¸ªåèåå¨ï¼è±æä¸æ±ååæ¶åå¨æ¶å®¹æé ææ··ä¹±ï¼Unicodeå符éå°±æ¯ä¸ºäºè§£å³å符éè¿ç§ä¸å ¼å®¹çé®é¢è产ççï¼å®ææçå符é½ç¨ä¸¤ä¸ªåè表示ï¼å³è±æå符ä¹æ¯ç¨ä¸¤ä¸ªåè表示ãncharãnvarcharçé¿åº¦æ¯å¨1å°4000ä¹é´ãåcharãvarcharæ¯è¾èµ·æ¥ï¼ncharãnvarcharåæå¤åå¨4000个å符ï¼ä¸è®ºæ¯è±æè¿æ¯æ±åï¼ècharãvarcharæå¤è½åå¨8000个è±æï¼4000个æ±åãå¯ä»¥çåºä½¿ç¨ncharãnvarcharæ°æ®ç±»åæ¶ä¸ç¨æ å¿è¾å ¥çå符æ¯è±æè¿æ¯æ±åï¼è¾ä¸ºæ¹ä¾¿ï¼ä½å¨åå¨è±ææ¶æ°éä¸æäºæ失ã
温馨提示:答案为网友推荐,仅供参考