Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Базы";
Текущий архив: 2005.02.06;
Скачать: [xml.tar.bz2];

Вниз

функции SQL   Найти похожие ветки 

 
AlexTregubov   (2005-01-10 17:29) [0]

Мастера, подскажите пожалуйста, где взять инфу по SQL,  частности, по различным встроенным функциям, типа Month(Date), Day(Date) и прочим подобным.
Очень надо.
Заранее  спасибо


 
Anatoly Podgoretsky ©   (2005-01-10 17:38) [1]

Гы, ты думаешь оно одинаковое по разным серверам и движкам?


 
AlexTregubov   (2005-01-10 17:42) [2]

Уточняю: для ADO Access и MS SQL


 
Anatoly Podgoretsky ©   (2005-01-10 17:46) [3]

Первое - справка из Офиса.
Второе - Book On Line (идет с MS SQL или качается с их сайта).


 
AlexTregubov   (2005-01-10 17:48) [4]

Спасибо, буду копать.
Хотелось правда ссылочку на какой-нить e-book.


 
sniknik ©   (2005-01-10 17:56) [5]

и то есть у тебя на машине, при условии что есть мсофис (нерезаный) и mssql.


 
Anatoly Podgoretsky ©   (2005-01-10 20:59) [6]

А это и есть е-боок
Первый на твоей машине, если справку не инсталировал, до доустанови.
А второе на сайте Микрософт или в дистрибутиве MS SQL
Вроде я это уже ранее указал.


 
Fay ©   (2005-01-11 02:14) [7]

DATEPART
Returns an integer representing the specified datepart of the specified date.

Syntax
DATEPART ( datepart , date )

Arguments
datepart

Is the parameter that specifies the part of the date to return. The table lists dateparts and abbreviations recognized by Microsoft® SQL Server™.

Datepart Abbreviations
year yy, yyyy
quarter qq, q
month mm, m
dayofyear dy, y
day dd, d
week wk, ww
weekday dw
hour hh
minute mi, n
second ss, s
millisecond ms

The week (wk, ww) datepart reflects changes made to SET DATEFIRST. January 1 of any year defines the starting number for the week datepart, for example: DATEPART(wk, "Jan 1, xxxx") = 1, where xxxx is any year.

The weekday (dw) datepart returns a number that corresponds to the day of the week, for example: Sunday = 1, Saturday = 7. The number produced by the weekday datepart depends on the value set by SET DATEFIRST, which sets the first day of the week.

date

Is an expression that returns a datetime or smalldatetime value, or a character string in a date format. Use the datetime data type only for dates after January 1, 1753. Store dates as character data for earlier dates. When entering datetime values, always enclose them in quotation marks. Because smalldatetime is accurate only to the minute, when a smalldatetime value is used, seconds and milliseconds are always 0.

If you specify only the last two digits of the year, values less than or equal to the last two digits of the value of the two digit year cutoff configuration option are in the same century as the cutoff year. Values greater than the last two digits of the value of this option are in the century that precedes the cutoff year. For example, if two digit year cutoff is 2049 (default), 49 is interpreted as 2049 and 2050 is interpreted as 1950. To avoid ambiguity, use four-digit years.

For more information about specifying time values, see Time Formats. For more information about specifying dates, see datetime and smalldatetime.

Return Types
int

Remarks
The DAY, MONTH, and YEAR functions are synonyms for DATEPART(dd, date), DATEPART(mm, date), and DATEPART(yy, date), respectively.

Examples
The GETDATE function returns the current date; however, the complete date is not always the information needed for comparison (often only a portion of the date is compared). This example shows the output of GETDATE as well as DATEPART.

SELECT GETDATE() AS "Current Date"
GO

Here is the result set:

Current Date                
---------------------------
Feb 18 1998 11:46PM        

SELECT DATEPART(month, GETDATE()) AS "Month Number"
GO

Here is the result set:

Month Number
------------
2            

This example assumes the date May 29.

SELECT DATEPART(month, GETDATE())
GO

Here is the result set:

-----------
5          

(1 row(s) affected)

In this example, the date is specified as a number. Notice that SQL Server interprets 0 as January 1, 1900.

SELECT DATEPART(m, 0), DATEPART(d, 0), DATEPART(yy, 0)

Here is the result set:

----- ------ ------
1     1      1900



Страницы: 1 вся ветка

Форум: "Базы";
Текущий архив: 2005.02.06;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.47 MB
Время: 0.041 c
3-1104320501
k2
2004-12-29 14:41
2005.02.06
В какую сторону можно оптимизировать запрос?


9-1099344741
Klopan
2004-11-02 00:32
2005.02.06
Звук газа


1-1106220683
salexn
2005-01-20 14:31
2005.02.06
RichEdit и поиск текста


3-1104378632
Russko
2004-12-30 06:50
2005.02.06
Динамический запрос на вставку


1-1106488173
Dmitry_04
2005-01-23 16:49
2005.02.06
Как мне установить сервис?





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский