Viewing 15 posts - 646 through 660 (of 1,439 total)
Lots of options. For your temporary table solution you can do this
WITH CTE AS (
SELECT date_year,
date_and_time,
...
February 27, 2012 at 8:55 am
Per year as below. As for not using CTEs, you could change the CTE to a derived table, but that's pretty much just a cosmetic difference.
WITH CTE AS (
SELECT...
February 27, 2012 at 7:56 am
You can use this to give you output 2. Output 1 is where Rank is 1
WITH CTE AS (
SELECT date_and_time,
ROW_NUMBER() OVER(ORDER...
February 27, 2012 at 6:49 am
Here's another way. For any comma, count the number of double quotes preceeding it. If there is an even number count it, otherwise ignore.
WITH CTE AS (
SELECT t.id,
...
February 23, 2012 at 6:47 am
See if this helps
DECLARE @t TABLE(xmlCol NTEXT)
INSERT INTO @t(xmlCol)
VALUES('<NewDataSet>
<XmlLink>
<ObjectId>123456</ObjectId>
<ObjectName>Jo Bloggs</ObjectName> ...
February 23, 2012 at 4:54 am
Have a look here
http://www.sqlservercentral.com/Forums/Topic1248957-392-1.aspx
February 22, 2012 at 3:33 am
I think it simplifies to this
SELECT
startdate
,enddate
,descript
FROM testdates
WHERE @End >= startdate AND @Start<=enddate
ORDER BY startdate, enddate
February 22, 2012 at 2:42 am
WITH CTE AS (
SELECT ID, peter, mike, steve,
ROW_NUMBER() OVER(PARTITION BY Peter ORDER BY Mike DESC) AS rn
FROM dbo.ATable)
SELECT peter, mike,...
February 22, 2012 at 2:20 am
Using my query from here
http://www.sqlservercentral.com/Forums/Topic1125847-392-1.aspx
WITH StartsAndEnds(StartEnd,StartDate,EndDate,CustomerID,ServiceType) AS (
SELECT 'S' AS StartEnd,
StartDate,
DATEADD(day,-1,StartDate),
...
February 21, 2012 at 5:37 am
DECLARE @t TABLE(X CHAR(1), Y CHAR(1))
INSERT INTO @t(X,Y)
SELECT 'A' ,'B' UNION ALL
SELECT 'A' ,'B' UNION ALL
SELECT 'A' ,'C' UNION ALL
SELECT 'A' ,'C' UNION ALL
SELECT 'A' ,'C' UNION ALL
SELECT 'A' ,'D'...
February 20, 2012 at 9:15 am
dwain.c (2/20/2012)
However the...
February 20, 2012 at 3:59 am
February 13, 2012 at 7:02 am
Gianluca Sartori (2/13/2012)
ekknaveen (2/13/2012)
even if you can suggest me the general query which will work in all databases it would be great
I don't think such a syntax exists. I'm afraid...
February 13, 2012 at 6:15 am
Viewing 15 posts - 646 through 660 (of 1,439 total)