Database - Built-in-functions
1.Mathametical
Function
select abs(-2)
select ceiling(74.3)
select floor(74.4)
select exp(0)
select round(74.2868,3)
select round(74.2868,2)
select round(74.2868,1)
select round(74.2862,3)
select round(74.2865,3)
2.Trignometric
Function
select sin(90)
select cos(45)
select Tan(90)
select log(10)
3.String
Function
select ascii('a')
'American Standard
Code for Information Interchange'
'ANSI-American
National Standards Institute'
select char(70)
select reverse('sample')
select substring('welcome',4,4)
select substring('welcome',4,2)
select substring('welcome',4,5)
select substring('welcome',4,1)
select substring('welcome',4,3)
select stuff('ram',2,1,'sri')
select stuff('ram',2,2,'sri')
select stuff('ram',2,3,'sri')
select stuff('ram',2,0,'sri')
select replicate('good',2)
select (' Kumar')
select ('Kumar ')
select ltrim(' Kumar')
select rtrim('Kumar ')
4.Date Functions
select getdate()
select dateadd(yy,3,getdate())
select datediff(hh,'2010-08-31',getdate())
select datediff(yy,'2010-08-31',getdate())
select datediff(mm,'2010-08-31',getdate())
select datediff(dd,'2010-08-31',getdate())
select datepart(dd,getdate())
select day(getdATE())
select MONTH(getdATE())
select YEAR(getdATE())
5.System
Functions 0--> False ,1-->True
select db_id('Master')
select db_id('first')
select db_name('10')
select isdate('2/30/2000')
select isdate('2/2')
select isnumeric('4')
select isnumeric('w')
select suser_id('sa')
select suser_name(3)
6.Aggregate
Function
sp_tables
select * from emp
select count(*) from emp
select count(salary) from emp
select max(salary) from emp
select min(salary) from emp
select avg(salary) from emp
select sum(salary) from emp
Comments
Post a Comment