powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / MSSQL] DATEPART function
2 сообщений из 2, страница 1 из 1
MSSQL] DATEPART function
    #32026049
Maxim
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Есть поле в таблице
d DATETIME

Проблема в том, что DATEPART понимает только присловутые запросы типа DATEPART(dd, d)

А надо вывести что-нибудь типа
select DATEPART('yy-mm-dd', d) from xxx;
...
Рейтинг: 0 / 0
MSSQL] DATEPART function
    #32026053
Replicant
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
DATEPART
-Returns an integer representing the specified datepart of the specified date.

Используй CONVERT (data_type[(length)], expression [, style])


where style

Is the style of date format you want when converting datetime or smalldatetime data to character data ( nchar, nvarchar, char, varchar, nchar, or nvarchar data types ), ....
In the table, the two columns on the left represent the style values for datetime or smalldatetime conversion to character data. Add 100 to a style value to get a four-place year that includes the century (yyyy).

Успехов
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / MSSQL] DATEPART function
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]