(EDITED - data type and language info added)
I created a view Foo2
for an employee. Whenever he tries to refresh the data, he is getting error:
[DataSource.Error] Microsoft SQL Server: the conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value.
When I (sysadmin role) try to refresh data in the Excel sheet everything goes smoothly and query in SSMS does not throw any errors. The user also uses another view Foo1
- a previous version of Foo2
. That one works as expected.
Right now I am at this point:
SELECT
statements in Foo1
and Foo2
to be exactly the sameFoo1
view - MS_DiagramPane1 and MS_DiagramPaneCount (don't know what they are)Language and data type related info:
SQL_Slovak_CP1250_CI_AS
)LOGIN
s is the same (Slovak - slovenčina
)USER
s is the same (SQL_Slovak_CP1250_CI_AS
)CAST
, CONVERT
or other data type changes occour in the viewFoo1
and Foo2
are the sameI suspect, that the user group was given a permission on that particular view Foo1
, but I don't know how to test this theory.
So the problem was the WHERE
part of he SELECT
statement.
SELECT
clmn1
,clmn2
,clmn3
FROM table1
WHERE clmn1 > '2017-12-31'
The column clmn1
is data type smalldatetime
. I still don't understand the reason, since implicit conversion from varchar
to smalldatetime
should be possible. At least according to the chart here:
The SELECT
statement works as dasired after using CONVERT
in the WHERE
clause:
SELECT
clmn1
,clmn2
,clmn3
FROM table1
WHERE clmn1 > CONVERT(smalldatetime, '2017-12-31 23:59:59', 120)
I guess I'm missing something. Anyway - problem solved.