참고 : docs.microsoft.com/ko-kr/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver15
-- 실행 1
select max(yearlyIncome) as 최고수입
from DimCustomer (nolock)
/***********************
실행 1 의 결과
최고수입
-----------
1 170000.00
***********************/
----------------------------
-- 실행 2
declare @yIncome float
select @yIncome = max(yearlyIncome)
from DimCustomer (nolock)
select @yIncome as 최고수입
----------------------------
-- 실행 3
declare @yIncome numeric
select @yIncome = max(yearlyIncome)
from DimCustomer (nolock)
select @yIncome as 최고수입
----------------------------
-- 실행 4
declare @yIncome decimal(10, 2)
select @yIncome = max(yearlyIncome)
from DimCustomer (nolock)
select @yIncome as 최고수입
----------------------------
-- 실행 5
declare @yIncome numeric(10, 2)
select @yIncome = max(yearlyIncome)
from DimCustomer (nolock)
select @yIncome as 최고수입
결과 2, 3 최고수입 ------------- 1 170000 -------------------------------------------- 결과 4, 5 최고수입 ------------- 1 170000.00 |
'[prog] SQL - MSSQL' 카테고리의 다른 글
Practical SQL Queries for Microsoft SQL Server 2008 R2 (0) | 2020.11.04 |
---|---|
SQL SERVER - SSMS tip (0) | 2020.10.15 |
MSSQL 날짜변환 / 날짜계산CONVERT / DATETIME (0) | 2020.10.11 |
자주 사용하는 쿼리문들 (Queries Frequently Used) (0) | 2020.09.17 |
SQL SERVER / 서버의 DB 를 로컬로 복사(가져오기) (0) | 2020.09.09 |