본문 바로가기

DataBase

(31)
MS SQL Data Range 퍼온글 http://cafe.naver.com/devweb/32 분류데이터 타입범위저장소크기정수BitO 또는 1bitInt-2,147,483,648 ~ 2,147,483,6474 바이트Smallint-32,768 ~ 32,7672 바이트Tinyint0 ~ 2551 바이트Bigint-2^63 ~ 2^63-18 바이트부동소수점Float[n]-1.79E+308 ~ 1.79E+308 n = 1~244 바이트Float[n]-1.79E+308 ~ 1.79E+308 n = 25~538 바이트Real-3.40E + 38 ~ 3.40E + 384 바이트문자데이터char[n]n = 1~8000n 바이트Varchar[n]n = 1~8000varchar [ ( n | max ) ]max는 최대 저장소 크기가 2^31-1바이트..
MS SQL 2014 IP ENABLE 시키기 SQLServerManager12.msc for [SQL Server 2014] SQLServerManager11.msc for [SQL Server 2012] SQLServerManager10.msc for [SQL Server 2008], SQL Server Network Configuration 메뉴 클릭Protocals for MSSQLSERVER 메뉴 클릭TCP/IP 속성 enabled로 변경 double 클릭 IPAdresses 탭에서 해당 IP 사용으로 바꿈
ms sql 데이터 row 컬럼 콤마로 연결하기 select cd_nm + ','from tcn_code where parent_cd = '80' and language_cd = 'zh-cn' for xml path('')
mssql isnumeric 함수(숫자체크) 업무를 하고 있는데 특정 상황에서 Sum값이 에러가 난다. 쩝 원인은 데이터중 숫자가 아닌 놈들이 있었다 일단 합산을 할때 다음과 같이 숫자임을 체크하고 아래와 같이 sum을 하였다 select sum(case when isnumeric(total) = 1 then total else 0 end) as sum_totalfrom tablewhere condition
특장한 날짜로 부터 주차의 시작 날짜 가져오기 DATEADD(week, (datepart(week, getdate()) - datepart(week, study_start_date) ), DATEADD(DAY, @@datefirst - DATEPART(weekday, CAST(YEAR(GETDATE()) AS VARCHAR) + '-01-01') - 6, CAST(YEAR(GETDATE()) AS VARCHAR) + '-01-01')),DATEADD(week, (datepart(week, getdate()) - datepart(week, study_start_date) ), DATEADD(DAY, @@datefirst - DATEPART(weekday, CAST(YEAR(GETDATE()) AS VARCHAR) + '-01-01') , CAST(YE..
Ms Sql replace select replace( menu_path, '/Lecture', '/Lecture2') from clsc..tcl_menuwhere company_seq = 472 and menu_path like '%/Lecture%'
CTE 사용 ;with listas(select c.* from clsc.dbo.tcl_process_category cinner join clsc.dbo.tcl_process_category_study son c.company_seq = s.company_seqand c.category_no = s.category_nowhere s.company_seq = @company_seqand s.cp_code = @cp_cdand s.study_cd = @process_cdunion allselect c.* from clsc.dbo.tcl_process_category cinner join list lon c.company_seq = l.company_seqand c.category_no = l.parent_categor..
try catch문 http://polyphagia.egloos.com/264013위의 블로그에서 발췌한 내용입니다. 2005이상부터 적용된다. begin try begin tran insert into aaa values () insert into bbb values () commit tran end try begin catch print error_message() rollback tran end catch