Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2004, 10:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: South Bend, Indiana, USA.
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Type error but it is the correct type

I get the error

"Syntax error converting the nvarchar value 'Feed Screw' to a column of data type int"

But my field "ToolTypeDesc" is not an int, so what is going on?

ALTER PROCEDURE dbo.spDataValidation_NotEntered_Screw
(@BeginDate nvarchar(20),
@EndDate nvarchar(20))
AS SELECT dbo.T_SetupSheetHistoryProduction.QuoteID, dbo.T_SetupSheetHistoryProduction.ECN, dbo.T_SetupSheetHistoryProduction.WONum,
                      dbo.T_SetupSheetHistoryProduction.Revision, MIN(dbo.T_SetupSheetHistoryProduction.Date) AS MinDate,
                      MAX(dbo.T_SetupSheetHistoryProduction.Date) AS MaxDate, MIN(dbo.T_Tooling.ToolTypeDesc) AS [Screw?],
                      SUM(dbo.T_SetupSheetHistoryProduction.TotalSetup + dbo.T_SetupSheetHistoryProduction.TotalRun + dbo.T_SetupSheetHistoryProduction.TotalDown +
                       dbo.T_SetupSheetHistoryProduction.TotalScrapTime + dbo.T_SetupSheetHistoryProduction.TotalTearDown) AS TotTime
FROM dbo.T_SetupSheetHistoryProduction LEFT OUTER JOIN
                      dbo.T_SetupSheetHistoryToolDetail ON dbo.T_SetupSheetHistoryProduction.Revision = dbo.T_SetupSheetHistoryToolDetail.Revision AND
                      dbo.T_SetupSheetHistoryProduction.ECN = dbo.T_SetupSheetHistoryToolDetail.ECN AND
                      dbo.T_SetupSheetHistoryProduction.WONum = dbo.T_SetupSheetHistoryToolDetail.WOID AND
                      dbo.T_SetupSheetHistoryProduction.QuoteID = dbo.T_SetupSheetHistoryToolDetail.QuoteID LEFT OUTER JOIN
                      dbo.T_Tooling ON dbo.T_SetupSheetHistoryToolDetail.ActualToolID = dbo.T_Tooling.ToolID
WHERE (dbo.T_SetupSheetHistoryProduction.Date BETWEEN @BeginDate AND @EndDate) AND (dbo.T_Tooling.ToolTypeDesc LIKE N'Feed Screw')
GROUP BY dbo.T_SetupSheetHistoryProduction.QuoteID, dbo.T_SetupSheetHistoryProduction.ECN, dbo.T_SetupSheetHistoryProduction.WONum,
                      dbo.T_SetupSheetHistoryProduction.Revision
HAVING (MIN(dbo.T_Tooling.ToolTypeDesc) IS NULL) OR
                      (MIN(dbo.T_Tooling.ToolTypeDesc) = 0) AND
                      (SUM(dbo.T_SetupSheetHistoryProduction.TotalSetup + dbo.T_SetupSheetHistoryProduction.TotalRun + dbo.T_SetupSheetHistoryProduction.TotalDown +
                       dbo.T_SetupSheetHistoryProduction.TotalScrapTime + dbo.T_SetupSheetHistoryProduction.TotalTearDown) > 0)
ORDER BY dbo.T_SetupSheetHistoryProduction.WONum
__________________
Mitch
 
Old March 19th, 2004, 11:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Looks like it objects to this line:
HAVING ... MIN(dbo.T_Tooling.ToolTypeDesc) = 0

That would be consistent with the error "Syntax error converting the nvarchar value 'Feed Screw' to a column of data type int"

hth
Phil
 
Old March 19th, 2004, 11:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: South Bend, Indiana, USA.
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Phil, you beat me to it; I was just loging back in to update my post as say that after playing with it I dicovered that it was the Min line and not the where line.

If I take the "=0" away then it runs. Now I jsut got to see what the imnportance of the "=0" line was in the first place. (I'm converting this from an Access query)




Similar Threads
Thread Thread Starter Forum Replies Last Post
data type error message Vince_421 Access VBA 3 June 11th, 2007 06:50 AM
Changing data type error kuku SQL Server 2000 1 August 18th, 2005 10:20 AM
Error with SmallDateTime data type saturdave Classic ASP Databases 1 November 22nd, 2004 07:19 PM
Data Type mismatch error clueless_may Access VBA 1 May 5th, 2004 09:16 AM
Data Type Mismatch error transcona Classic ASP Databases 4 June 25th, 2003 07:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.