Saturday, October 26, 2013

Special Functions in SQL SERVER

Special functions:
db_name():
Returns name of the current database.
select db_name()

user_name()
Returns name of the user
select user_name()

host_name()
Returns name of the server
select host_name()

IDENT_CURRENT(‘tablename’)
This function returns current value of the identity.
select IDENT_CURRENT('login')

IDENT_SEED(‘tablename’)
This function returns the starting value of the identity.
select IDENT_SEED('login')

IDENT_INCR(‘tablename’)
This function returns increment value.

select IDENT_INCR('login')

isnumeric()
isnumeric,isexpression,if expression,isnumber
This function returns 1 otherwise ‘0’
select isnumeric(10)

isdate()
If expression is date, returns 1 otherwise ‘0’
select ISDATE(getdate())

isnull()
this function is used to convert null values.
Syntax: isnull(expr1,expr2)

if expr1 is null, it returns exp2
if expr is not null, it returns exp1 only.

select isnull(200,100)

select isnull(null,100)



No comments:

Post a Comment

Thank you for visiting my blog

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...