Responding , the insert error occurs because you try to enter the date in a format not expected by the database, and the unexpected result in select > is for the same reason.
Explaining: The format of the date as a string accepted by SQL Server, by default, depends on the language of the user you are using to connect to the database, which is defined by default in accordance with the installation language of SQL Server itself, which is defined by default according to the operating system language.
But the user language can also be overridden by session settings , and the date format itself accepts as a string can also be overwritten by session settings.
When you think that you have found the correct format and start using it for all your code, eventually this code will run in a slightly different environment and will go to give error, or worse: it will happen to bring incorrect results or save incorrect information to the bank.
The good practice is to use parameters to report dates or any other value in SQL commands, this avoids this and other potential problems.
If you need to report the date as a string, without using parameters, report it in one of two universally supported by SQL Server formats regardless of settings. Namely:
-
yyymmdd for date,
- or yyyy-mm-ddThh: mm: ss [.mmm] for date and time.
This will serve both insert and select or any other command.
Note: these two formats are ISO standard.
In your case, the select telling date and time would look like this:
select * from NOME_TABELA where DATA_FISCAL = '2016-05-11T00:00:00.000'