dot design 출력하기
음 책 검수해야 하는데......
마음 다잡고 다시 으쌰 으쌰~
if object_id('tblx') is not null
drop table tblx
go
create table tblx
(cval char(1)
,x int
,y int
)
go
--필요한 dot design 노가다
insert tblx values ('1',1,3) , ('1',2,2) , ('1',2,3) , ('1',3,3) , ('1',4,3) , ('1',5,3) , ('1',6,3) , ('1',7,3)
, ('2',1,2) , ('2',1,3) , ('2',2,1) , ('2',2,4) , ('2',3,4) , ('2',4,2) , ('2',4,3) , ('2',5,1) , ('2',6,1) , ('2',7,1) , ('2',7,2) , ('2',7,3) , ('2',7,4)
, ('3',1,2) , ('3',1,3) , ('3',2,1) , ('3',2,4) , ('3',3,4) , ('3',4,2) , ('3',4,3) , ('3',5,4) , ('3',6,1) , ('3',6,4) , ('3',7,2) , ('3',7,3)
, ('4',1,3) , ('4',2,3) , ('4',3,2) , ('4',3,3) , ('4',4,1) , ('4',4,3) , ('4',5,1) , ('4',5,2) , ('4',5,3) , ('4',5,4) , ('4',6,3) , ('4',7,3)
, ('5',1,1) , ('5',1,2) , ('5',1,3) , ('5',1,4) , ('5',2,1) , ('5',3,1) , ('5',4,1) , ('5',4,2) , ('5',4,3) , ('5',5,4) , ('5',6,4) , ('5',7,1) , ('5',7,2) , ('5',7,3)
, ('6',1,2) , ('6',1,3) , ('6',2,1) , ('6',2,4) , ('6',3,1) , ('6',4,1) , ('6',4,2) , ('6',4,3) , ('6',5,1) , ('6',5,4) , ('6',6,1) , ('6',6,4) , ('6',7,2) , ('6',7,3)
, ('7',1,1) , ('7',1,2) , ('7',1,3) , ('7',1,4) , ('7',2,1) , ('7',2,4) , ('7',3,4) , ('7',4,4) , ('7',5,4) , ('7',6,4) , ('7',7,4)
, ('8',1,2) , ('8',1,3) , ('8',2,1) , ('8',2,4) , ('8',3,1) , ('8',3,4) , ('8',4,2) , ('8',4,3) , ('8',5,1) , ('8',5,4) , ('8',6,1) , ('8',6,4) , ('8',7,2) , ('8',7,3)
, ('9',1,2) , ('9',1,3) , ('9',2,1) , ('9',2,4) , ('9',3,1) , ('9',3,4) , ('9',4,2) , ('9',4,3) , ('9',4,4) , ('9',5,4) , ('9',6,1) , ('9',6,4) , ('9',7,2) , ('9',7,3)
, ('0',1,2) , ('0',1,3) , ('0',2,1) , ('0',2,4) , ('0',3,1) , ('0',3,4) , ('0',4,1) , ('0',4,4) , ('0',5,1) , ('0',5,4) , ('0',6,1) , ('0',6,4) , ('0',7,2) , ('0',7,3)
, ('-',4,1) , ('-',4,2)
, (':',2,2) , (':',6,2)
-- 필요한 컬럼만큼 출력
select max(case when cval = substring(num,1,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,1,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,1,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,1,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,2,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,2,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,2,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,2,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,3,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,3,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,3,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,3,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,4,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,4,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,4,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,4,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,5,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,5,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,6,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,6,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,6,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,6,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,7,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,7,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,7,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,7,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,8,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,8,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,9,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,9,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,9,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,9,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,10,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,10,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,10,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,10,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,11,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,11,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,12,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,12,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,12,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,12,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,13,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,13,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,13,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,13,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,14,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,14,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,14,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,15,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,15,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,15,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,15,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,16,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,16,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,16,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,16,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,17,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,17,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,17,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,18,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,18,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,18,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,18,1) and y = 4 then '■' else '' end)a
, max(case when cval = substring(num,19,1) and y = 1 then '■' else '' end)a
, max(case when cval = substring(num,19,1) and y = 2 then '■' else '' end)a
, max(case when cval = substring(num,19,1) and y = 3 then '■' else '' end)a
, max(case when cval = substring(num,19,1) and y = 4 then '■' else '' end)a
from tblx a
cross join (select convert(varchar(20), getdate(), 120) num) b -- 도트에 있는 출력할 문자열 입력
group by x
order by x