DB이야기2011/04/13 04:45

if OBJECT_ID('tmp_test') is not null drop table tmp_test

create table tmp_test (col nvarchar(50) not null)

 

go

 

insert into tmp_test values('a')

insert into tmp_test values('a  ')  -- a + 공백 두개

insert into tmp_test values('a   ') -- a + 공백 세개

go

 

select * from tmp_test where col = 'a'
--결과

col
a
a  
a   

select

      LEN(col) [len]

    , DATALENGTH(col) [datalength]

    , ascii(RIGHT(col, 1)) [ascii]

from

    tmp_test

--결과

len datalength ascii
1 2 97
1 6 32
1 8 32


update tmp_test set col = col + 'x'

select * from tmp_test
--결과

col
ax
a  x
a   x


왜 그 양반들은 이런걸로 날 엿먹이는 거야 ..
저작자 표시

'DB이야기' 카테고리의 다른 글

DB 이야기  (0) 2011/05/03
공백 이야기  (0) 2011/04/13
Lock pages in memory Setting for 64 bit Standard Edition of SQL Server  (0) 2011/01/19
아 쓰댕..  (0) 2010/12/17
Posted by yangdb