Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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,
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
Reply With Quote
  #2 (permalink)  
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

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"

Reply With Quote
  #3 (permalink)  
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

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)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 01:07 AM.

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