Viewing 15 posts - 1 through 15 (of 19 total)
How about this?
SELECT *
FROM #testenvironment
WHERE PARSENAME(CAST(yourdata AS NVARCHAR(MAX)),3) IS NULL
October 25, 2012 at 8:15 am
Select LTRating
,RHDate
from Accounts
WHERE LTRating <> 'D' OR RHDate = DATEADD(DD,-365,GETDATE())
October 4, 2012 at 3:43 am
Interesting stuff!
Is there any specific reason when we do the following
DECLARE @Date1 DATETIME SET @Date1= '2012-08-28 11:53:00'
select CAST(cast(@Date1 AS float) AS DATETIME)
That we lose 3 ms in the process of...
October 2, 2012 at 1:36 am
Is the difference between the start date and end date of each row always fixed to be one day?
Assuming it, something like this should do the trick:
;with sample_data AS
(
SELECT 769...
September 19, 2012 at 2:54 am
Would there ever actually be a business need for this? If so I think that some more fundamental questions need to be addressed!! 😀
September 18, 2012 at 2:36 am
@ThomasKeller - I found the information from SimMetrics (linky) to be quite useful - what i think would be really interesting to see would be a weighted version of this...
September 18, 2012 at 2:08 am
I've tended to find using a CLR implementation of the Jaro-Winkler algorithm has suited my needs a bit more, but really cool to see a T-SQL only alternative!
September 18, 2012 at 1:18 am
This doesn't use pivot but should do the job anyway:
SET DATEFORMAT YMD
;WITH data as
(
SELECT 'Cat A' as category, '2011-10-01' as date,1 as response
UNION ALL SELECT 'Cat A','2011-10-01',0
UNION ALL SELECT 'Cat...
December 13, 2011 at 8:51 am
I think this should do the trick?
SELECT
table1.strlocation
,COUNT(table2.extension) as number_lines
,COUNT(table3.circuitTrunk) as number_trunks
FROM tblUCSU table1
INNER JOIN tblSCSU table2 on table2.adjPen2= table1.strPen
INNER JOIN tblTACSU table3 on table3.adjPen2= table1.strPen
GROUP BY table1.strlocation
If there are records...
October 12, 2011 at 8:11 am
Would this work:
SELECT name FROM company
UNION ALL
SELECT keywords FROM company
UNION ALL
SELECT area FROM landmark
UNION ALL
SELECT landmarkName FROM landmark
Or does the ordering of the data within the one column differ from...
October 12, 2011 at 3:08 am
Gianluca has a strong point - I recently ran a similar query (with days), and by continually running through and adding another day onto duplicate cases, I was filling in...
September 16, 2011 at 4:35 am
I think this should work for the specific month figures:
;with percentile as
(
select
CAST(number AS DECIMAL(18,3)) as number
,month_name
,row_number() OVER (PARTITION BY month_name order by number asc) as row
from #data
)
,percentile2...
September 14, 2011 at 2:33 am
You say that you want the median for each month - is this instead of the 95th percentile or on top (i.e. does the query need to calculate both simultaneously?)
September 13, 2011 at 5:15 pm
Try this:
Based on the definition you gave, you can enter the percentile in the declare bit, or hard code it instead of the @percentile instead if you are always going...
September 13, 2011 at 3:29 am
Sorry didn't spot it was a BIT! As Ninja's said, casting / converting to INT should do the trick
June 9, 2011 at 9:51 am
Viewing 15 posts - 1 through 15 (of 19 total)