Re: Newbie help: sql string conversion

From: David Portas (REMOVE_BEFORE_REPLYING_dportas_at_acm.org)
Date: 10/29/04


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
--


Relevant Pages

  • Re: Newbie help: sql string conversion
    ... David Portas writes: ... > 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. ...
    (microsoft.public.access.queries)
  • Re: Newbie help: sql string conversion
    ... As I said I'd rather keep them in this format for now. ... If these are numeric measurements ... > you will be much better off storing them with a numeric datatype. ... > SQL Server MVP ...
    (microsoft.public.access.queries)
  • ZPack update
    ... of note, a few additions have been made to the format, in particular: ... building an indexing structure and storing it to disk may make sense. ... index structure at load time, which may make the most sense for directories ... nature of the format (most implementations of b-trees I have seen have been ...
    (comp.compression)
  • Re: Standards question on edited fields
    ... > Who said I was storing it? ... and it seems you would not present such a format to ... it's not a sloppy design at all - and there is a valid reason. ... Judson McClendon ...
    (comp.lang.cobol)
  • Re: 2D height map to 3D model?
    ... (you're storing 12 doubles for almost every data-point). ... If you have a format that allows for triangle/quadrilateral strips, ... can make the rendering far more efficient using them. ...
    (comp.lang.python)