[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using CINT in a query

Posted on 2006-10-21
2
Medium Priority
?
14,376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 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 93

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

650 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