Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Select 
		--Convert(Varchar(30),a.VIANO,113) VIANO,
		--Convert(Varchar(30),b.VIANO,113) VIANO,
		--Convert(Varchar(30),c.VIANO) VIANO,
		((b.discharge_total_moves+b.loaded_total_moves+ b.onboard_total_moves
		+b.via_yard_total_moves+b.discharge_oog_total_moves+b.loaded_oog_total_moves) /
		dbo.min_to_hrmi_format_new(DateDiff(MI, a.OPS_COMM_DT,
		a.OPS_COMP_DT))) GROSS_WORKING_TIME, 
		((b.discharge_total_moves+b.loaded_total_moves+ b.onboard_total_moves
		+b.via_yard_total_moves+b.discharge_oog_total_moves+b.loaded_oog_total_moves) /
		c.REAL_CRANE_HRS) REAL_CRANE_RATE,
		((b.discharge_total_moves+b.loaded_total_moves+ b.onboard_total_moves
		+b.via_yard_total_moves+b.discharge_oog_total_moves+b.loaded_oog_total_moves) /
		c.NET_CRANE_HRS) NET_CRANE_RATE
		From dbo.TDR_VSL_MASTER a inner join  tdr_cal b
 on a.VIANO = b.viano 
 inner join DWH_REPORTING.dbo.DAILY_VSL_DETAILS c
 on b.viano= c.VIANO
Posted
Updated 28-Apr-14 2:44am
v2
Comments
Mehdi Gholam 28-Apr-14 2:55am    
Clearly one of your data items is not convertible to a numeric value. Since we cannot see your data then you will have to figure this out on your own.
phyxian 28-Apr-14 3:20am    
into what kind of numeric are you going to convert your varchar into?
CHill60 28-Apr-14 8:45am    
What are the data types of your columns on tdr_cal?
What is the return type of function min_to_hrmi_format_new?

1 solution

Well its hard to understand your query but we can help you debug your sql and identify which field is creating problem. You can debug your sql like this and see which field has invalid data one by one

SQL
Select
        --Convert(Varchar(30),a.VIANO,113) VIANO,
        --Convert(Varchar(30),b.VIANO,113) VIANO,
        --Convert(Varchar(30),c.VIANO) VIANO,
        cast(b.discharge_total_moves as varchar(30))
        --cast(b.loaded_total_moves as varchar(30)),
        --cast(b.onboard_total_moves as varchar(30)),
        --cast(b.via_yard_total_moves as varchar(30)),
        --cast(b.discharge_oog_total_moves as varchar(30)),
        --cast(b.loaded_oog_total_moves as varchar(30)),
        --cast(c.REAL_CRANE_HRS as cast(30)),
        --cast(c.NET_CRANE_HRS as varchar(30))
        From dbo.TDR_VSL_MASTER a inner join  tdr_cal b
 on a.VIANO = b.viano
 inner join DWH_REPORTING.dbo.DAILY_VSL_DETAILS c
 on b.viano= c.VIANO
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900