Viewing 15 posts - 691 through 705 (of 1,439 total)
Can someone jump in here... seems like a simple problem made really complicated and I'm losing the will to live.
http://www.sqlservercentral.com/Forums/Topic1234021-1292-1.aspx
January 13, 2012 at 8:07 am
This won't include the encoding header
DECLARE @t TABLE( VARCHAR(20), value VARCHAR(20))
INSERT INTO @t(,value)
SELECT 'proyect','2901' UNION ALL
SELECT 'user','usrsession'
SELECT (
SELECT AS "@key",
...
January 13, 2012 at 7:28 am
Sorry, I still don't get it. Why only one landline value per datakey, surely you need to consider all landline values to count the number of distinct ones.
Here's a simple...
January 13, 2012 at 7:02 am
<snip>
I'm not convinced these queries work at all even though they apparently give desired results.
This one
select count(distinct landline) as Unique_landlines
from (select *, row_number() over(partition by datakey order by...
January 13, 2012 at 6:25 am
stephen99999 (1/12/2012)
select count(distinct datakey) as Unique_Dataset
from (select *, row_number() over(partition by datakey order by case when Datakey!='' then 0 else...
January 13, 2012 at 2:44 am
bicky1980 (1/12/2012)
stephen99999 (1/12/2012)
January 12, 2012 at 7:49 am
Is this what you're after?
SELECT COUNT(*) AS Total,
COUNT(DISTINCT datakey) AS Uniquedatakey,
COUNT(DISTINCT CASE WHEN landline<>'' THEN landline...
January 11, 2012 at 9:09 am
Something like this?
WITH CTE AS (
SELECT [User],GWP,
ROW_NUMBER() OVER(PARTITION BY [User] ORDER BY GWP DESC) AS rn
FROM MyTable)
SELECT [User],GWP
FROM CTE
WHERE rn=1;
January 11, 2012 at 2:26 am
Ninja's_RGR'us (1/10/2012)
Gianluca Sartori (1/10/2012)
I don't know which countermeasures can be taken, if any. I would be extremely upset...
January 10, 2012 at 6:02 am
Common table expressions (the 'WITH' bit) go at the start of the query.
WITH TempTable AS (
SELECT ConstraintBasedGroupId, Constraints
FROM ConstraintBasedGroupBase
),
ResourceGroupToTeam AS (
SELECT
TempTable.ConstraintBasedGroupId,
SUBSTRING(item,CHARINDEX('{',item)+1,CHARINDEX('}',item)-CHARINDEX('{',item)-1) AS TeamId
FROM TempTable
CROSS APPLY
DelimitedSplit8K(REPLACE(Constraints,'||','|'),'|') split
)
SELECT ...
January 9, 2012 at 4:38 am
SELECT t1.Name, t1.PDate, t1.Value, COALESCE(SUM(t2.Value),0) AS Value1
FROM #tTest t1
LEFT OUTER JOIN #tTest t2 ON t2.Name=t1.Name
...
December 20, 2011 at 8:51 am
Dev (12/20/2011)
GSquared (12/20/2011)
December 20, 2011 at 6:35 am
Change
SELECT *
FROM OPENXML (@idoc, 'NewDataSet/Sheet1', 1)
WITH ([Column1] [varchar](50),
[Column2] [varchar](50) )
to
SELECT *
FROM OPENXML (@idoc, 'NewDataSet/Sheet1', 1)
WITH ([Column1] [varchar](50) 'Column1',
[Column2] [varchar](50) 'Column2')
December 15, 2011 at 6:43 am
inuts (12/13/2011)
yes, I had already tried that on an untyped xml column but mine is typed here 🙁
Can you post the schema?
December 13, 2011 at 8:24 am
Viewing 15 posts - 691 through 705 (of 1,439 total)