Quantcast
Channel: Sql And Me » system function
Browsing all 10 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Using Built-in System Function – $PARTITION

you can use @PARTITION TSQL function to check which partition will be mapped to a specified column value. For example if you have a partition function with four partitions as below: – © 2011 – Vishal...

View Article



Image may be NSFW.
Clik here to view.

Using Built-in System Functions – NEWID() and NEWSEQUENTIALID()

You can use NEWID() and NEWSEQUENTIALID() to create a unique value of type UNIQUEIDENTIFIER. You can use the NEWID() as any other TSQL function as below: – © 2011 – Vishal (http://SqlAndMe.com)...

View Article

Image may be NSFW.
Clik here to view.

Using Built-in System Function – HOST_NAME()

You can use the HOST_NAME() function to get the client workstation name from which the query is executed. You can use it as: – © 2011 – Vishal (http://SqlAndMe.com)   SELECT @@SERVERNAME, HOST_NAME()...

View Article

Image may be NSFW.
Clik here to view.

Using Built-in system function – IDENTITY()

IDENTITY() function can be used to create a new Identity column for a table, You can only use this function in a SELECT statement with INTO clause. Syntax: IDENTITY ( data type, seed, increment ) AS...

View Article

Image may be NSFW.
Clik here to view.

Using Built-in system functions – LEN() and DATALENGTH()

While LEN() is used to return the number of characters in a String, DATALENGTH() can be used to return the number of bytes used by any expression. LEN() and DATALENGTH() functions are useful for...

View Article


Image may be NSFW.
Clik here to view.

Using Built-in system functions – IDENT_CURRENT(), IDENT_INCR(), IDENT_SEED()

When an identity column is created, we need to specify the initial value and an increment value for the identity column. You can retrieve the seed and increment values using IDENT_SEED and IDENT_INCR...

View Article

Image may be NSFW.
Clik here to view.

Using Built-in system functions – UPDATE()

UPDATE() function can be used to determine whether an INSERT or UPDATE was made on the specified column. You can use it inside a trigger to test if a column has been updated by INSERT/UPDATE statement....

View Article

Image may be NSFW.
Clik here to view.

Using Built-in system functions – COALESCE()

COALESCE() can be used to return first non-null value from the specified arguments. A typical scenario to use COALESCE() is when you need to retrieve value from another column when the primary column...

View Article


Image may be NSFW.
Clik here to view.

Using SQL DMVs – sys.dm_db_task_space_usage

sys.dm_db_task_space_usage contains details for allocation/de-allocation pages for activity tasks for database. It returns below columns: 1. session_id – session id 2. request_id – request id within...

View Article


Image may be NSFW.
Clik here to view.

SQL Functions – LOGINPROPERTY()

The LOGINPROPERTY() SQL function can be used to retrieve policy settings related to logins. It takes two arguments, Login Name and Property Name as below: LOGINPROPERTY('Login Name','Property Name')...

View Article
Browsing all 10 articles
Browse latest View live




Latest Images