Re: Newbie help: sql string conversion
From: David Portas (REMOVE_BEFORE_REPLYING_dportas_at_acm.org)
Date: 10/29/04
- Next message: Gary B: "Amount NOT Found..."
- Previous message: Ed Ardzinski: "Re: Create/Save Query on the Fly"
- In reply to: steve: "Newbie help: sql string conversion"
- Next in thread: steve: "Re: Newbie help: sql string conversion"
- Reply: steve: "Re: Newbie help: sql string conversion"
- Reply: Erland Sommarskog: "Re: Newbie help: sql string conversion"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 29 Oct 2004 20:08:25 +0100
Why is the data stored in this format? If these are numeric measurements you
will be much better off storing them with a numeric datatype. Storing
numbers as strings will just make your queries difficult and slow and also
make it hard to maintain any data integrity. Fix the design and convert the
data to numeric form is my advice.
If you've no other choice you could try something like this:
SELECT col
FROM Measurements
WHERE CAST(LEFT(col,6) AS INTEGER) > -2.5
AND CAST(LEFT(col,6) AS INTEGER) < 12.4
-- David Portas SQL Server MVP --
- Next message: Gary B: "Amount NOT Found..."
- Previous message: Ed Ardzinski: "Re: Create/Save Query on the Fly"
- In reply to: steve: "Newbie help: sql string conversion"
- Next in thread: steve: "Re: Newbie help: sql string conversion"
- Reply: steve: "Re: Newbie help: sql string conversion"
- Reply: Erland Sommarskog: "Re: Newbie help: sql string conversion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|