Groups | Blog | Home
all groups > sql server data mining > november 2003 >

sql server data mining : Substring'ing a Number-field


Mirador
11/20/2003 4:37:54 AM
Hi :) and thanx for reading my post.

I have to create a view based on a character in a number-field (fnr)
which is 11 char's long. I have to get character nr "7".

The problem is that i cannot use :

--> SELECT fnr FROM table WHERE substring(fnr,7,1)
since it's not a string.

Any other way i can solve this ? Would be greatly and insanely happy if
anyone could help me out with a sample code or something.!



Best regards
Mirador

*** Sent via Developersdex http://www.developersdex.com ***
Raman Iyer [MS]
11/20/2003 11:38:46 AM
Forwarding to a more appropriate newsgroup.
..

[quoted text, click to view]

Adam Machanic
11/20/2003 3:33:46 PM
SELECT fnr FROM table WHERE SUBSTRING(CONVERT(VARCHAR, fnr), 7, 1) ...

Note that performance is really going to be horrible with this method...
Since you appear to be using the column as a bitmask (or is it integer mask)
of sorts, I recommend you seriously consider splitting it into multiple
columns.


[quoted text, click to view]

AddThis Social Bookmark Button