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 |
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2013-08-08 : 07:15:19
|
COALESCE([t1].[DateCancelled],[t1].[CompletionDate]) [TheDate]I am getting the following error:The conversion of a date data type to a smalldatetime data type resulted in an out-of-range valueDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-08-08 : 07:30:11
|
COALESCE(CAST(t1.DateCancelled AS DATE), CAST(t1.CompletionDate AS DATE)) AS TheDate Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-08-08 : 07:45:01
|
whats the datatype of DateCancelled and CompletionDate?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
sivadss2007
Starting Member
18 Posts |
Posted - 2013-08-28 : 09:44:18
|
Use the caste function to convert to datetime for 'datecancelled' and 'completiondate'P.Siva |
|
|
ShivaKrishna
Starting Member
20 Posts |
Posted - 2013-08-28 : 11:34:24
|
One of the date is in smalldatetime datatype but other is not in smalldatetime and so it might resulted in erroruse the following:COALESCE(CAST(t1.DateCancelled AS smalldatetime), CAST(t1.CompletionDate AS smalldatetime)) AS TheDate |
|
|
VeeranjaneyuluAnnapureddy
Posting Yak Master
169 Posts |
Posted - 2013-08-29 : 08:42:49
|
COALESCE(CAST(CONVERT(VARCHAR,t1.DateCancelled) AS SMALLDATETIME),CAST(CONVERT(VARCHAR,t1.CompletionDate) AS SMALLDATETIME))AS TheDateveeranjaneyulu |
|
|
|
|
|
|
|