Uri Dimant
3/1/2007 8:57:00 AM
SM
SQL Server "loves" YYYYMMDD format
CREATE TABLE #t (dt DATETIME)
GO
DECLARE @dt DATETIME
SET @dt=CONVERT(VARCHAR(30),REPLACE('2007.03.01. 11:20:20','.','') ,112)
INSERT INTO #t SELECT @dt
SELECT * FROM #t
DELETE FROM #t
"SM" <SM@discussions.microsoft.com> wrote in message
news:8A0BE27A-B0B8-477C-B090-3ADD41D27354@microsoft.com...
> Thanks Adi,
> But the problem is that after checking the date format for few more
> regional
> settings I have found that this issue would arise with some more of them.
> I.e. with regional settings as Bulgarian, I'd have to write code to remove
> those other characters at the end of date value as well. Thats why I
> wanted
> to have a generic solution. May be at the DB level.
>
> "Adi" wrote:
>
>> On Mar 1, 9:21 am, SM <S...@discussions.microsoft.com> wrote:
>> > I am trying to fire a query having the WHERE clause on Date Time field.
>> > But
>> > with Latvian Regional settings the date value comes as 'yyyy.mm.dd.'.
>> > The
>> > last dot (.) in the string creates problem. Does anyone knows how to
>> > tackle
>> > this?
>>
>> Why can't you make sure that the GUI that you are using will remove
>> the last dot?
>>
>> Adi
>>
>>