Rajesh Kumar

Rajesh Kumar

  • NA
  • 6
  • 3.6k

Store procedure date conversion error.

Sep 17 2014 6:34 AM
Hi,
I have a store procedure that giving some error in running.
error"Conversion failed when converting date and/or time from character string"
USE [db]
GO
/****** Object: StoredProcedure [db].[Select_Top5] Script Date: 09/17/2014 15:24:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [db].[Select_Top5]
as
begin
select top 5 RANK() OVER (ORDER BY convert(int, Round(( Cast( DATEDIFF(YY,convert(datetime,Playerdob,101),( select convert(datetime,getdate(),101) ) )*bowlingpoint as Float)/32),0)) desc) AS Rank,PlayerId,PlayerName, Round(( Cast( DATEDIFF(YY,convert(datetime,Playerdob,101),( select convert(datetime,getdate(),101) ) )*bowlingpoint as Float)/32),0) as bowlingpoint ,Totalmatches, t.TeamName as Team,t.TeamId as TeamId from Playerprofile join TeamProfile t on Playerprofile.TeamId=t.TeamId
end
Can anyone able to solve this problem.
Thanks

Answers (2)