Viewing 15 posts - 331 through 345 (of 1,439 total)
spaghettidba (6/24/2013)
Paul, your answers could be collected in a book and it would be an absolute best-seller!Awesome, as usual.
+1
June 24, 2013 at 2:10 am
SELECT t1.name AS list1,
t2.name AS list2,
count(distinct c2.name) AS commonColumns
FROM sys.tables t1
CROSS JOIN sys.tables t2
INNER JOIN...
June 20, 2013 at 2:23 am
If you change the data, replacing
, ('E3A22', geometry::STGeomFromText('LINESTRING(00 12, 07 12)', 0))
with
, ('E3A22', geometry::STGeomFromText('LINESTRING(06 12, 07 12)', 0))
so that...
June 19, 2013 at 8:06 am
tssopa (6/19/2013)
... I had read how efficient and fast recursive CTE's are compared to CURSOR's...
Typically they're not. You could try splitting out a temporary table from the CTE.
IF OBJECT_ID('tempdb..#Base')...
June 19, 2013 at 6:38 am
If you don't know how many attribute there are in advance then you will have to use dynamic SQL - not possible for a view.
June 19, 2013 at 4:54 am
Not exactly sure what you want here, but try this
SELECT s.StockCode,
s.StockName,
MAX(CASE WHEN AttributeName='SpecialField1' THEN AttributeClass END)...
June 19, 2013 at 4:47 am
Here's another way using recursive CTEs
WITH Base AS (
SELECT A.ShapeID AS ShapeID_A, B.ShapeID AS ShapeID_B
FROM dbo.OverlappingShapes AS A
INNER JOIN dbo.OverlappingShapes AS B
...
June 19, 2013 at 2:54 am
WITH CTE AS (
SELECT userid,picture,
ROW_NUMBER() OVER(PARTITION BY userid ORDER BY picture) AS rn
FROM pictures)
SELECT userid,
MAX(CASE WHEN...
June 18, 2013 at 4:40 am
Chrissy321 (6/14/2013)
Thanks, interesting. I wouldn't have thought to use cross apply.
June 14, 2013 at 8:25 am
Any chance you're on SQL Server 2012?
SELECT LocationID,
stamp AS startStamp,
FIRST_VALUE(stamp) OVER(PARTITION BY LocationID
...
June 14, 2013 at 2:55 am
WITH CTE AS (
SELECT ProductType,
SUM(CASE WHEN ProductRank >= 5 THEN ProductSales ELSE 0 END) AS GoodGrade,
SUM(CASE...
June 14, 2013 at 2:17 am
Maybe this?
DENSE_RANK() OVER (ORDER BY IDIS_ACTV_ID,ACTV_HOME_PROPERTY_ID) AS BUILDINGID,
June 13, 2013 at 6:34 am
SELECT Account Number,QTY,Name,ROWID, SUM(CONVERT(INT,QTY)) OVER(PARTITION BY AccountNo) AS UOM
FROM tfrOrderTransmissionDetailLog
WHERE DateDiff(dd, [TIMESTAMP],GetDate())=0
ORDER BY UOM DESC
June 13, 2013 at 3:37 am
WITH CTE AS (
SELECTid, oracle_id, field1, field2, field3, field4,
ROW_NUMBER() OVER(PARTITION BY field1, field2, field3 ORDER BY field4 DESC)...
June 13, 2013 at 1:41 am
Can you explain how you get the value 781?
June 12, 2013 at 7:40 am
Viewing 15 posts - 331 through 345 (of 1,439 total)