With this clause:
where
CAST(substring(Column,1,1) as int) & 128 > 0
--
I try to find result where first bit is on.
Is there a better way to write this to speed up ?
Any help much appreciated.
Regards.
Fabri
-Mandrake "A Poma', c'hai 'na faccia...!"
-Pomata "S, se ce n'avevo due gi stavo all'universit... sotto
spirito!"Best get rid of the bit mask column and store the data as separate
attributes or rows. Bit maps are a poor and very inefficient way to
store data.
David Portas
SQL Server MVP
--|||David Portas wrote:
> Best get rid of the bit mask column and store the data as separate
> attributes or rows. Bit maps are a poor and very inefficient way to
> store data.
David, you are right.
But what about when you inherit a large data with these schema?
Do you think, also I'll try to migrate before or later, I can write that
where clause better?
I add that <column> is binary data type.
Regards.
Fabri
-Mandrake "A Poma', c'hai 'na faccia...!"
-Pomata "S, se ce n'avevo due gi stavo all'universit... sotto
spirito!"|||I'd suggest adding a table to store extracted relevant values from that
"overloaded" column. That way the old table remains intact and you gain a ne
w
relation to help you with your queries.
The only change to the old table would be a trigger to help propagate those
values to the new table (for inserted, updated, and deleted rows
respectively).
ML|||>> <column> is binary data type.<<
Quit writing assembly language in SQL.
Create a proper 1NF table. Put each attrivute in its own column, with
appropriate constraints. When you do this, you will probably find that
the data is very dirty. Drop the old table.
Fire the moron that wrote this code. This will improve future data
quality and make programming much easier.|||Firing morons just helps problems migrate somewhere else.
ML|||--CELKO-- wrote:
You are "that" CELKO ? 0__0
> Quit writing assembly language in SQL.
lol
> Create a proper 1NF table.
What does it mean 1NF?
> Fire the moron that wrote this code.
lol...even if I don't know what moron means I can try to figure it
out..:-)))
Regards.
Fabri
-Mandrake "A Poma', c'hai 'na faccia...!"
-Pomata "S, se ce n'avevo due gi stavo all'universit... sotto
spirito!"|||>> Firing morons just helps problems migrate somewhere else. <<
Operative word: "somewhere else" :) As I used to remind people at teh
last university I taught, I don't teach ethics or morals.|||>> You are "that" CELKO ? <<
Eat just one little baby and everyone remembers your name!
First normal form. It means that each column holds one and only one
scalara (atomic) value; not a list, not an array, not a sub-table. Any
book on RDBMS will have a formal definition.
person stupida|||--CELKO-- wrote:
>
> Eat just one little baby and everyone remembers your name!
CELKO, can I use this as signature?
Fabri
(Eat just one little baby and everyone remembers your name! |CELKO|)
No comments:
Post a Comment