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.
Author |
Topic |
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2009-07-14 : 17:56:10
|
[code]
I got the below error
Server: Msg 241, Level 16, State 1, Line 8 Syntax error converting datetime from character string.
as i found few dates are invalid in the Student_info..
please help..I want the data to be displayed with the valid dates...if the dates are not correct it should avoid that dates..
select StudentId, Student_DT_MNTH , Student_DT_DT, Student_DT_YR From Student_info where CAST(CAST(Student_DT_YR AS VARCHAR) + RIGHT('0' + CAST(Student_DT_MNTH AS VARCHAR), 2) + RIGHT('0' + CAST(Student_DT_DT AS VARCHAR), 2) AS DATETIME) Between @FROMDATE And @TODATE
[/code] |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|