Reputation: 10576
I have a sheet in Excel. One column in it ("ID") contains strings with values: 1.01, 1.02, 1.03, 2.01, 3.01, 3.04 etc.
I want to get all rows in that sheet, where "ID" is >= some value using SQL statement and ADO connection (from VBScript code). So, I have two questions:
1) Can I convert ID's values to double in SQL? So, then I can compare values as floating point numbers and apply < and > conditions. 2) Can I use in select statement Macro from Excel workbook?
Upvotes: 1
Views: 20369
Reputation: 57063
The CAST
to FLOAT
function is CDbl()
e.g.
SELECT CDbl(ID) AS ID_float
FROM [Sheet$];
Note DOUBLE
is a synonym for FLOAT
, hence the contraction C
ast to D
oubl
e
Upvotes: 4
Reputation: 10576
I found the solution: if I cast column to Integer, I'll have the same effect, so, I used CInt function:
Select * from ["&strSheetName&"$] where CInt(TestCaseId) >= " & abs (strRow)
Upvotes: 0