Sql Server×Ö¶ÎÀàÐ͵Ä×Ö·û³¤¶È
sql serverÊý¾ÝÀàÐÍcharºÍnchar,varcharºÍnvarchar,textºÍntextÔÊÐíµÄ×Ö·û³¤¶È
×Ö·û´®
char
¹Ì¶¨³¤¶ÈµÄ·Ç Unicode ×Ö·ûÊý¾Ý£¬×î´ó³¤¶ÈΪ 8,000 ¸ö×Ö·û¡£
varchar
¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×Ϊ 8,000 ¸ö×Ö·û¡£
text
¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×î´ó³¤¶ÈΪ 2^31 - 1 (2,147,483,647) ¸ö×Ö·û¡£
Unicode ×Ö·û´®
nchar
¹Ì¶¨³¤¶ÈµÄ Unicode Êý¾Ý£¬×î´ó³¤¶ÈΪ 4,000 ¸ö×Ö·û¡£
nvarchar
¿É±ä³¤¶È Unicode Êý¾Ý£¬Æä×î´ó³¤¶ÈΪ 4,000 ×Ö·û¡£sysname ÊÇϵͳÌṩÓû§¶¨ÒåµÄÊý¾ÝÀàÐÍ£¬ÔÚ¹¦ÄÜÉϵÈͬÓÚ nvarchar(128)£¬ÓÃÓÚÒýÓÃÊý¾Ý¿â¶ÔÏóÃû¡£
ntext
¿É±ä³¤¶È Unicode Êý¾Ý£¬Æä×î´ó³¤¶ÈΪ 2^30 - 1 (1,073,741,823) ¸ö×Ö·û¡£
¶þ½øÖÆ×Ö·û´®
binary
¹Ì¶¨³¤¶ÈµÄ¶þ½øÖÆÊý¾Ý£¬Æä×î´ó³¤¶ÈΪ 8,000 ¸ö×Ö½Ú¡£
varbinary
¿É±ä³¤¶ÈµÄ¶þ½øÖÆÊý¾Ý£¬Æä×î´ó³¤¶ÈΪ 8,000 ¸ö×Ö½Ú¡£
image
¿É±ä³¤¶ÈµÄ¶þ½øÖÆÊý¾Ý£¬Æä×î´ó³¤¶ÈΪ 2^31 - 1 (2,147,483,647) ¸ö×Ö½Ú¡£
Ïà¹ØÎĵµ£º
Ò»¡¢PL/SQL±à³Ì¹æ·¶Ö®´óСд
¾ÍÏñÔÚSQLÖÐÒ»Ñù£¬PL / SQLÖÐÊDz»Çø·Ö´óСдµÄ¡£ÆäÒ»°ã×¼ÔòÈçÏ£º
¹Ø¼ü×Ö(BEGIN, EXCEPTION, END, IF THEN ELSE,LOOP, END LOOP)¡¢Êý¾ÝÀàÐÍ(VARCHAR2, NUMBER)¡¢ÄÚ²¿º¯Êý(LEAST, SUBSTR)ºÍÓû§¶¨ÒåµÄ×Ó³ÌÐò(procedures, functions,packages)£¬Ê¹Óôóд¡£
±äÁ¿ÃûÒÔ¼°SQLÖеÄÁÐÃûºÍ±íÃû£¬Ê¹ÓÃÐ ......
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
CREATE function Get_StrArrayLength
(
@str varchar(1024), --Òª·Ö¸îµÄ×Ö·û´®
@split varchar(10) --·Ö¸ô·ûºÅ
)
......
--¼ì²âCPUѹÁ¦µÄÒ»¸ö·½·¨ÊǼÆËãÔËÐÐ״̬ÏµĹ¤×÷½ø³ÌÊýÁ¿£¬
--ͨ¹ýÖ´ÐÐÈçϵÄDMV²éѯ¿ÉÒԵõ½Õâ¸öÐÅÏ¢
SELECT COUNT(*) AS workers_waiting_for_cpu,t2.scheduler_id
from sys.dm_os_workers AS t1, sys.dm_os_schedulers AS t2
WHERE t1.state='RUNNABLE' AND
t1.scheduler_address = t2.scheduler_address A ......