SQL fails to convert types, but why -


i trying filter query following way:

declare @cubeyear varchar(30) --setting way can later used in ssas cubes set @cubeyear = '[date].[year].&[2013]' select [rankingid]       ,[year]       ,[customer]       ,[rank] [obase].[dbo].[fact_kunderanking] '[date].[year].&[' + year  + ']' = @cubeyear 

but keep getting following error:

conversion failed when converting varchar value '[date].[year].&[2013]' data type int.

does know solution might be?

try -

where '[date].[year].&[' + cast(year varchar(4)) + ']' = @cubeyear 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -