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 2008 Forums
 Transact-SQL (2008)
 SQL QUERRY ERROR

Author  Topic 

kond.mohan
Posting Yak Master

213 Posts

Posted - 2011-11-29 : 08:26:37


Hi,
i am executing query with union all

select * from table3
union all
select * from table2
union all
(select * from table3 union all select * from table4)

i got this error

Conversion failed when converting date and/or time from character string.

error not showing proper line in ssms

and above all queries using 3 or 4 datetime columns
-------

individual queries are executing properly
conversions are required

kindly show me the path









mohan

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-11-29 : 10:27:54
Look at the columns in table3 that are of type datetime or smalldatetime. Then, look at the corresponding columns in table2 and table4 at the same ordinal positions. I suspect some of those columns may not be of datetime/smalldatetime data type, and that the data in one or more of those columns would be something that cannot be implicitly converted to a date.
Go to Top of Page
   

- Advertisement -