218 Part I EXAM PREPARATION Be careful with

218 Part I EXAM PREPARATION Be careful with the use of appropriate functions because nondeterministic functions cannot be used in a lot of processes. An index cannot be created on a computed column if the expression references any nondeterministic functions, and a clustered index cannot be created on a view if the view references any nondeterministic functions. Functions can be divided into categories that are each addressed separately over the remainder of this exam objective coverage. Date Functions In T-SQL, as with many other programming languages, date manipulation has been given special importance, by the many functions available. Dates are implemented as datetime and smalldatetime data types and need to be treated with special functions such as DATEDIFF. Dates cannot be added or subtracted using the regular operators. The date functions available in SQL Server enable you to change and manipulate dates easily; the dates must be in datetime or smalldatetime type. The next couple of sections cover the date functions found in SQL Server. DATEADD The DATEADD function adds a number to the part of the date you specify, such as month or day, and then returns the new datetime value. The syntax is DATEADD (date_part, number, date) Where: Date_part determines which unit of measure of time. A listing of the possible values accepted is shown in Table 4.7. Number determines the number by which you want to increase the date_part. Date is a datetime or smalldatetime value. The DATEADD function adds an interval to a date you specify. For example, if the shipping dates of all invoices in the backorders table slip three days, you can get the new dates with this statement: SELECT DATEADD(day, 3, shipdate) FROM backorders

For reliable and cheap web hosting services please check tomcat web hosting website.

Comments are closed.