¾È±Ô °øºÎ¹æ

MS-SQL > NULL °ü·Ã ÇÔ¼ö

µî·ÏÀÏ : 2017-06-30 17:32 Á¶È¸¼ö : 52,524

1. ISNULL()
    
ISNULLÀº NULL°ªÀ» ´ëü°ªÀ¸·Î ¹Ù²Ù¾î ¹ö¸³´Ï´Ù.
Çü½Ä: ISNULL(NULL°ª, ´ëü°ª)

SELECT ISNULL(MAX(NUMBER)+1,1)  FROM BOARD

NUMBER Çʵ忡¼­ °¡ÀåÅ«°ª¿¡¼­ 1¸¦ ´õÇÑ°ªÀÌ NULL À̸é 1¸¦ °¡Áö°í ¿À°í, ±×·¸Áö ¾ÊÀ¸¸é +1 °ªÀ̵ȴÙ.

2. NULLIF()

NULLIFÇÔ¼ö´Â µÎ°³ÀÇ Ç¥Çö½ÄÀ» ºñ±³ÇÏ¿© °°À¸¸é NULLÀ» ¹ÝȯÇÕ´Ï´Ù.
Ʋ¸®¸é Ç¥Çö½Ä1 °ªÀ» Ãâ·ÂÇÑ´Ù.
Çü½Ä: NULLIF(Ç¥Çö½Ä1, Ç¥Çö½Ä2) 

SELECT NULLIF(-123,+123),NULLIF(500,500)       
°á°ú - > -123 , NULL


3. GETANSINULL()

GETANSINULLÀº µ¥ÀÌÅͺ£À̽º°¡ Á¸ÀçÇϸé 1 ±×·¸Áö ¾ÊÀ¸¸é NULL Ç¥½ÃÇØÁÝ´Ï´Ù.
Çü½Ä: GETANSINULL(µ¥ÀÌÅͺ£À̽º À̸§)   

4. NULL °ªÀ» °¡Áø ÇÊµå ±¸Çϱ⠠  

null°ªÀ» °¡Áö°í ÀÖ´Â goods_type Çʵ尪À» °¡Áö°í ¿À°í ½ÍÀ»¶§,


select * from goods where  goods_type is null


¿Í °°ÀÌ ÇÏ¸é µÈ´Ù.

select * from goods where  goods_type is not null

NULL °ªÀÌ ¾Æ´Ñ °ª¸¸ »Ì¾Æ¿É´Ï´Ù.
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.