Viewing 15 posts - 721 through 735 (of 1,923 total)
How about this?
; with TableCTE AS
(
SELECT *
FROM
( VALUES
(1, 3, 10, 'Red')
,(2, 3, 11, 'Red')
,(3, 3, 11, 'Red')
,(4, 3, 15, 'Blue')
,(5, 4, 10, 'Red')
,(6, 4, 11, 'Red')
,(7,...
July 7, 2011 at 10:18 pm
SQLkiwi (7/7/2011)
ColdCoffee (7/7/2011)
Paul, if u still on this thread, can you point me to your altenative to DISTINCT function?Sure.
THAT was a magical code 🙂 Thanks Paul..
July 7, 2011 at 11:25 am
ChrisM@Work (7/7/2011)
SQLkiwi (7/7/2011)
There's no need for a join at all - a point I realised after editing the TOP trick into your code. I have updated the code...
July 7, 2011 at 10:50 am
Something on the lines of this:
select *
from yourtable
where ( col1 + col2 + col3 ....... + col50 ) is not null
Concatenation of any value to a NULL yields NULL...
July 7, 2011 at 10:20 am
You can try something like this:
select top 100 name , CountOfRow = COUNT(*) OVER( PARTITION BY 1)
from sys.columns
July 1, 2011 at 1:11 pm
I remember answering to a question very similar to this one. I already see that u got ur reply, but here is (are) another way of doing it:
declare @t table...
June 29, 2011 at 1:22 pm
Paul-202125 (6/28/2011)
StartDate EndDate ChargeAmount
2007-05-30 2008-03-31 ...
June 28, 2011 at 4:09 pm
How about this?
; WITH UnpivotTable AS
(
SELECT CustomerId , Dates , Cols , ChargeAmount
, RN = ROW_NUMBER() OVER( ORDER BY Dates ASC)
FROM
(
SELECT
CustomerId
,ChargeType
,StartDate...
June 28, 2011 at 10:49 am
Yep, i know how to do this; But i want more information from you. I need to get the DDLs, DMLs for samples tables, sample table data , indexes etc..Please...
June 16, 2011 at 4:11 pm
ash0550 (6/16/2011)
Say the number of ID below 100 are 67 then in the result 67 should be displayed
u want all the 67 rows to have the row count value?
June 16, 2011 at 3:38 pm
Something like this?
select
SUM ( case when item <= 100 then 1 else 0 end) as [Below100count],
SUM ( case when item > 100 and item <= 500 then 1 else...
June 16, 2011 at 2:48 pm
You hit the "Submit" button before u completed the question, right? i dont find the requirement there :w00t:
June 16, 2011 at 1:32 am
Like this:
; with cte (items) as
( select 'line1'
union all select 'line2'
union all select 'line3'
union all select 'line4'
)
select ','+items
from cte
for xml path(''), type
June 15, 2011 at 7:57 pm
How about this?
; with diffenrentiator as
(
SELECT s.Rowid sRowID, s.SRC sSRC , s.OrgNo sOrgNo , s.Sdate sSate
,s.Edate sEdate , t.*,
...
June 15, 2011 at 1:26 pm
Viewing 15 posts - 721 through 735 (of 1,923 total)