Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Regarding SQL Datetime Problem in 2005

Author  Topic 

Khalid_68
Starting Member

2 Posts

Posted - 2008-11-23 : 23:57:48
Hi,
I have a application in Asp.net.From there I send a Insert statement to SQL 2005 Databases
1) INSERT INTO [EMPLS].[dbo].[Report_DataEntry_User] ( Login_User,Login_User_Name,Computer_Name,Login_DateTime ) VALUES ( 'test', 'khalid malik', 'dl1.avgate.net', '11/23/2008 12:57:44')
It give me error
The conversion of a char data type to a datetime data type
resulted in an out-of-range datetime value

2)i cut these statement paste in SQL query of 2005 it work perfect well without any problem?

I tried to Regional setting of local machine and server databases
it same
It did my experement i change the application date Format like MM/dd/yyyy hh:mm:ss i change to dd/MM/yyyy hh:mm:ss it works ? It impossible to change in whole application ? any other methods where i can configure SQL database Server ?

Can anybody help me ?
thank in advance

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 00:39:23
try like below

SET DATEFORMAT mdy

INSERT INTO [EMPLS].[dbo].[Report_DataEntry_User] ( Login_User,Login_User_Name,Computer_Name,Login_DateTime ) VALUES ( 'test', 'khalid malik', 'dl1.avgate.net', '11/23/2008 12:57:44')
Go to Top of Page

Khalid_68
Starting Member

2 Posts

Posted - 2008-11-24 : 00:55:42
hi visakh16
u mean to say i have send two statement from my application one set dateformat mdy and second is insert statement
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 01:10:17
quote:
Originally posted by Khalid_68

hi visakh16
u mean to say i have send two statement from my application one set dateformat mdy and second is insert statement


Yup. as the error may be because its not able to interpret corectly the send dat value from string send by appln.
Go to Top of Page
   

- Advertisement -