Tag Archive: sql


Here are few SQL Functions which would be useful when we do some tasks dealing with dates

Dateadd: Returns a new datetime value based on adding an interval to the specified date.

Syntax: DATEADD ( datepart, number, date )

Datediff: Returns the number of date and time boundaries crossed between two specified dates.

Syntax: DATEDIFF ( datepart, startdate, enddate )

Datename: Returns a character string representing the specified datepart of the specified date.

Syntax: DATENAME ( datepart, date )

Datepart: Returns an integer representing the specified datepart of the specified date.

Syntax: DATEPART ( datepart, date )

Day: Returns an integer representing the day datepart of the specified date.

Syntax: DAY ( date )

Getdate: Returns the current system date and time in the Microsoft® SQL Server™ standard internal format for datetime values.

Syntax: GETDATE ( )

Month: Returns an integer that represents the month part of a specified date.

Syntax: MONTH ( date )

Year: Returns an integer that represents the year part of a specified date.

Syntax: YEAR ( date )

Hope this would be helpful.

Sometime back I was asked the best way for processing records row by row. Cursor was the only solution that I was thinking till now.

But, the idea totally changed when I read an article today on row by row processing with triggers.

Here is the link. Read on …

http://www.sqlservercentral.com/columnists/asobati/2747.asp

Powered by WordPress. Theme: Motion by 85ideas.

Switch to our mobile site