Solved

Using CINT in a query

Posted on 2006-10-21
2
12,707 Views
Last Modified: 2008-03-03
Hi experts

My SQL query :

SQL = SQL & " AND ((cint(ShipOther1) <= " & ProdWeight & " AND " & ProdWeight & " <= cint(ShipOther2)) " 
               SQL = SQL & " OR (ShipCost1 <= " & ProdWeight & " AND " & ProdWeight & " <= ShipCost2)) " 

Returns an error:

Microsoft OLE DB Provider for ODBC Drivers erreur '80040e14'

(Microsoft}(ODBC SQL Server Driver}(SQL Server}'cint' is not a recognized function name.

/shopshippingcalc.asp, ligne 538

How can i fix this ?
Thx
0
Comment
Question by:humer2000
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 17779948
CInt() is not a SQL Server function--it is an Access/VB/VBA function.

For SQL Server, use CAST or CONVERT:

CONVERT(data_type, expression, [optional format type])
CAST(expression AS data_type)

SQL = SQL & " AND ((CONVERT(int, ShipOther1) <= " & ProdWeight & _
    " AND " & ProdWeight & " <= CONVERT(int, ShipOther2)) OR (ShipCost1 <= " _
    & ProdWeight & " AND & ProdWeight & " <= ShipCost2)) " 

You may also need to replace the & within the quotes to be + (SQL Server uses + as a string
concatenator).

Patrick
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17779964
Also be advised that the Integer data type for Access/VB/VBA is *not* the same as the
int data type in SQL Server.  SQL Server's int data type is analogous to the Access/VB/VBA
Long, and SQL Server's smallint data type is analogous to the Access/VB/VBA Integer.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now