R
R
Romario212018-01-29 13:02:37
SQL
Romario21, 2018-01-29 13:02:37

MSSQL data selection in date range?

Hello everyone, please help with the request, honestly not special in the database
exec sp_columns SysUserSession, shows the data type of CreatedOn ---> datetime2
visually the data is displayed in the column like this: 06/20/2017 8:05:32 AM
I make a request:
SELECT * FROM SysUserSession WHERE CreatedOn BETWEEN '20.06.2017 8:05:32' AND '21.06.2017 00:00:00'
I get: "Conversion failed when converting date and/or time from character string."
As far as I understand, the request cannot translate the string into the correct date format

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Skorzhinsky, 2018-01-29
@Romario21

Date-time string constant

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question