SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Unsupported Data Type from 2008 to 2005
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mike13
Posting Yak Master

Netherlands
200 Posts

Posted - 11/14/2012 :  07:16:13  Show Profile  Click to see mike13's MSN Messenger address  Reply with Quote
Got it to work on 2008 but i get <Unsupported Data Type> on 2005, any idea how to fix it

SELECT TOP (100) PERCENT managername, '(' + RTRIM(CAST(Aemails AS char)) + ') ' + shopname AS amountemails
FROM (SELECT managername, shopname,
(SELECT COUNT(*) AS msg
FROM dbo.T_Customer_Mailbox AS A
WHERE (datereply IS NULL) AND (status = 1) AND (ToUser = B.managername)) AS Aemails
FROM dbo.T_SYS_ShopSystem AS B) AS T
WHERE (Aemails > 0)
ORDER BY shopname

webfred
Flowing Fount of Yak Knowledge

Germany
8683 Posts

Posted - 11/14/2012 :  08:05:32  Show Profile  Visit webfred's Homepage  Reply with Quote
For everyone who is willing to help - here is a formatted query:
SELECT TOP (100) PERCENT 
managername, 
'(' + RTRIM(CAST(Aemails AS char)) + ') ' + shopname AS amountemails
FROM 
(
	SELECT 
	managername, 
	shopname,
	(SELECT COUNT(*) AS msg FROM dbo.T_Customer_Mailbox AS A WHERE (datereply IS NULL) AND (status = 1) AND (ToUser = B.managername)) AS Aemails
	FROM dbo.T_SYS_ShopSystem AS B
) AS T
WHERE (Aemails > 0)
ORDER BY shopname



Too old to Rock'n'Roll too young to die.
Go to Top of Page

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 11/14/2012 :  08:51:59  Show Profile  Reply with Quote
My guess is that this is a view and it doesn't like the CAST(Aemails AS char) without a length being specified. Since Aemails is an int, varchar(10) would be more appropriate.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

mike13
Posting Yak Master

Netherlands
200 Posts

Posted - 11/14/2012 :  09:48:29  Show Profile  Click to see mike13's MSN Messenger address  Reply with Quote
Thanks a lot that solved the issue
Go to Top of Page

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 11/14/2012 :  09:58:39  Show Profile  Reply with Quote
You're welcome.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000