开发者

DATEVALUE() function in VB6 and SQL Collations

开发者 https://www.devze.com 2023-04-11 23:09 出处:网络
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 eac

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号