Thursday, July 5, 2012

Useful Datetime Funtion

Date and Time in SQL Server
I am going to share my experience with you all dear!
To get difference between two ranges to date and time i have done using DATEDIFF funtion
My Example is:
I have From Date and To Date to get "Year” difference between these two dates 
SELECT DATEDIFF(YEAR, @Frmdt, @Todt ) as Duration 

Here i the most useful list of DateTime function

GETDATE()
DATEADD()
DATENAME()
DAY()
MONTH()
YEAR()
DATEDIFF()
CONVERT()
DATEPART()
SYSDATETIME()
SYSDATETIME()
SWITCHOFFSET()
TODATETIMEOFFSET()
ISDATE()
SYSUTCDATETIME()
GETUTCDATE()
CURRENT_TIMESTAMP()
DATEFROMPARTS()
DATETIME2FROMPARTS()
DATETIMEFROMPARTS()
DATETIMEOFFSETFROMPARTS()
SMALLDATETIMEFROMPARTS()               
TIMEFROMPARTS()
EOMONTH()






Sunday, April 1, 2012

Full Text Indexes with SQL Server 2008R2

Yah we have possibility of searching option in traditional T-SQL Language but Full Text Indexing much more powerful then T-SQL Language statement using Such as “LIKE”

Ex:-

USE AdventureWorks2008R2
GO

SELECT DISTINCT FirstName
FROM Person.Person
WHERE FirstName LIKE '%bert%'

The Result Was



Yah, we know the LIKE Operator in T-SQL is a Very Powerful Operator and its Finding String Value within strings.

It’s a pattern-based search, but there is big difference between searching for Substrings and searching for works.

The LIKE Operator is to search for Substring within Strings

And we have considered about Performance. An Index on a column is ignored when you are searching for values using pattern with a leading %wildcard