I'm stuck with this anoying problem on a NAV 5.01 database in SQL server (the database has the "Case sensitive" option enabled).
The problem is that I'm unable to search for items that contain letters in the Item field "No." using the WHERE-statement. Searching for items with a numeric item no. is no problem.
This works:
SELECT [No_]
,[Description]
FROM [My Database].[dbo].[My Company$Item]
WHERE [No_] = 1000
This fails:
SELECT [No_]
,[Description]
FROM [My Database].[dbo].[My Company$Item]
WHERE [No_] = 'abc123'
I've tried all sorts for casts without any success, like this:
WHERE [No_] = cast('abc123' as varchar(20))
(I thought Navision fields of type "sql_variant" = varchar in SQL ... but I guess not ...)
It still returns 0 records :-(
0
Comments
RIS Plus, LLC
A better example that doesn't work either:
WHERE [No_] = '07-0101-715-5'
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Note that I only have this problem with fields that are defined as "sql_variant" in SQL ... like the "No." and "No. 2" fields in the Item table.
Search on other fields works fine, like this one:
WHERE [Description] LIKE '%Flash%'
RIS Plus, LLC
A search like this (on the new server) works fine:
WHERE (No_ = '01-0206-411-7')
I can't find any differences between the two SQL servers, but there must be a problem with my local server.
PS! The field type CODE(20) from Navision is shown in SQL as "sql_variant"
I'll try to reinstall my local SQL server ...
Thanks for all help so far :-)
Can't believe I didn't try that before. The "cast"-statement should be on the other side ... of course:
WHERE cast([No_] as varchar(20)) = '09CARFST PORA'
Thanks Ola!
:-)
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
RIS Plus, LLC