/*
  The following queries illustrate report capabilities of MS SQL
  -- Prabakar 12/4/07
*/

-- use of function upper
select repnum, upper(Lastname)
from rep;

-- round function with 1 digit decimal precision
select partnum, round(price,1) as RoundedPrice
from part;

-- ceiling function will round the value to the next higher integer value
select partnum, ceiling(price) as RoundedUpPrice
from part;

-- floor function will round the value to the next lower integer value
select partnum, floor(price) as TruncatedPrice
from part;

-- concatenate two string columns
select repnum,(firstname + lastname) as Name
from rep;

-- Right trim one column and then concatenate
select repnum,(rtrim(firstname)+ ' ' + lastname) as Name
from rep;

-- Get the current date and time
select getDate()
from part;

-- extract the current day
select DAY(getDate())
from part;

-- extract the current month
select MONTH(getDate())
from part;

-- extract the current year
select YEAR(getDate())
from part;

-- For details on SQL Server 2005 reporting services,
--  from SQL Server Management Studio,
-- 	Help -> Tutorial -> SQL Server 2005 Tutorials
--		-> Reporting Services Tutorials

