DATEVALUE() function in VB6 and SQL Collations
Does the DATEVALUE() function produce different results for different collations in SQL server. For example, if you have two SQL servers with different collations (one American and one English) and each server has a database table, which contains a field that has the same date and the date is 01 February 2011,开发者_运维知识库 then can you ever expect different results using DateValue in VB6 i.e. is it possible for the datevalue to interpret the date as 02 January 2011 when extracting fron the American server.
Datevalue is ran on the client, so it is not dirrectly affected by the collation, but if you need to use it, then your SQL is returning a string instead of a date, and how that string is formatted is determined by the Dateformat setting on the server. That isn't determined by the collation, but non-us locations might change both.
If you can control the sql, then have it return a date and there's no problem, if not, you need to determine what it does return, then use date.parseexact.
精彩评论