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)
 help with sql query

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-03-11 : 01:05:43
oracle query want in sql

set @insertQuery1 = @insertQuery1 + 'to_date(''' + to_char(to_date(@APPOINTMENTDATE,'mm-dd-yyyy'),'dd-MON-yyyy') + ''',''dd-MON-yyyy''),'

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-03-11 : 01:28:29
I'm not Oracle expert,have you explain the scenario?

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-11 : 01:40:24
without knowing your full query, i guess . . .

set @insertQuery1 = @insertQuery1
+ ''''
+ convert(varchar(8), convert(datetime, @APPOINTMENTDATE, 103), 112)
+ ''''



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-03-11 : 02:04:59
giving eception like The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
mine APPOINTMENTDATE is a varchar field
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-11 : 02:10:52
quote:
Originally posted by rajasekhar857

giving eception like The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
mine APPOINTMENTDATE is a varchar field


that means your date string cannot be converted to datetime. Either it is not in the specified format or the date is not valid.

Check your data


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-03-11 : 02:15:37
then what to do then.need to change query
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-11 : 02:20:13
quote:
Originally posted by rajasekhar857

then what to do then.need to change query



check your data.

select *
from sometable
where isdate(thecol) <> 1



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -