Viewing 15 posts - 901 through 915 (of 2,894 total)
karthik M (11/19/2012)
select col1, col2, col3, col4, col5, Col6
,(s1+abs(s1)+s2+abs(s2)+s3+abs(s3)+s4+abs(s4)+s5+abs(s5)+ s6+abs(s6))/2 as Positive
...
November 20, 2012 at 3:39 am
dwain.c (11/19/2012)
Eugene Elutin (11/19/2012)
Michael Valentine Jones (11/19/2012)
This should work also:
select
...
union select 7,19,15,12,-13
union select 7,19,15,12,-13
It's not so simple as appears at first glance, so check my version...;-)
I think you meant to...
November 20, 2012 at 3:02 am
CELKO (11/19/2012)
...
Oh, IDENTITY cannot be a valid key for table either.
...
Sorry to disappointing you again, but it really can!
Have you tried it? If you need our...
November 19, 2012 at 11:51 am
CELKO (11/19/2012)
... Companies are identified by a DUNS (we even get radio ads for DUNS here in Austin!);...
That is real delight! How cool it is! There is only one...
November 19, 2012 at 11:43 am
kramaswamy (11/19/2012)
@TableB_ID IS NULL (TRUE) OR TableB_ID (Value OR...
November 19, 2012 at 11:20 am
kramaswamy (11/19/2012)
November 19, 2012 at 10:57 am
Actually, I found even more elegant way:
SELECT *
FROM tablename
...
November 19, 2012 at 10:45 am
Michael Valentine Jones (11/19/2012)
This should work also:
select
abs(sign(col1)+sign(col2)+sign(col3)+
sign(col4)+sign(col5)) as NegativeCount
sign(col1)+sign(col2)+sign(col3)+
sign(col4)+sign(col5)+5 as PositiveCount
from
MyTable
Have you tested it? You should try:
CREATE TABLE [dbo].[MyTable](
[col1] [int] NOT NULL,
[col2] [int] NOT NULL,
[col3] [int] NOT...
November 19, 2012 at 10:29 am
Before using one or another technique, you should read this article from one of the best experts in this area:
http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/
November 19, 2012 at 10:25 am
There is another, more mathematical way:
If no zero values in your columns:
select *, 5-Positives as Negatives
from (select *,(sign(col1)+sign(col2)+sign(col3)+sign(col4)+sign(col5)+5)/2 Positives
from tablename) sn
And, if there are zero values:
select...
November 19, 2012 at 10:17 am
eranzo111 (11/19/2012)
I was so happy when I saw the significant performence improvement when I used the full text search instead of the LIKE query,...
November 19, 2012 at 9:48 am
Jeff Moden (11/19/2012)
...
To answer the rest, the only way to know for sure is to run a test or two. If someone would create a CLR to drop characters...
November 19, 2012 at 9:36 am
SpringTownDBA (11/19/2012)
Full text querying only does prefix matching, not postfix'erin*' matches 'erinblah'
'*erin' doesn't match 'blaherin'
There is no way to match the last half of a word.
Ough, YES! And there is...
November 19, 2012 at 6:46 am
John Mitchell-245523 (11/19/2012)
November 19, 2012 at 6:19 am
farooq.hbs (11/19/2012)
Hi guys,If we include 'where' clause to the Left/Right outer joins, does it becomes inner join by default??
No it does not. It does really depend on what you put...
November 19, 2012 at 5:26 am
Viewing 15 posts - 901 through 915 (of 2,894 total)