Viewing 15 posts - 811 through 825 (of 3,543 total)
;WITH c (current_week,fromdate,todate) AS (
SELECT current_week,CAST(LEFT(current_week,10) as date),CAST(RIGHT(current_week,10) as date)
FROM #mytable
)
SELECT DISTINCT c.current_week,n.current_week AS [next_week]
FROM c
JOIN c n ON DATEADD(day,-8,SYSDATETIME()) BETWEEN n.fromdate and n.todate...
April 23, 2014 at 7:33 am
Grant Fritchey (4/23/2014)
Another way to do it is to use OPENQUERY. There are examples at the link.
Or OPENROWSET as referenced at the bottom of the link 🙂
April 23, 2014 at 7:12 am
1. The Report Server must be able to open a SQL Connection to the SQL Server
(I assume this is OK as you can run the report...
April 23, 2014 at 7:02 am
richardgregory06 (4/23/2014)
I"m still a bit confused which is typically the "Best Practice" to where I should put the criteria
It depends!
Check which method yields the best performance.
p.s.
Which is better
asking SQL Server...
April 23, 2014 at 6:41 am
1. You have anerror in your keyword table, both 'already' and 'Deactivated' have id=1
2. Like will not work as 'activated' keyword will find 'activated' and 'Deactivated'
Solution using splitter
SELECT m.[Description]
FROM...
April 17, 2014 at 7:28 am
SELECT t.CampusID,t.Campus,t.TermID,t.Term,t.StudentID,t.Qualification,t.Programme,s.Status
FROM [dbo].[MyTable] t
CROSS APPLY (
VALUES
('Repeat1stYear',t.Repeat1stYear)
,('Repeat2ndYear',t.Repeat2ndYear)
,('Repeat3rdYear',t.Repeat3rdYear)
,('ProgTo2ndYear',t.ProgTo2ndYear)
,('ProgTo3rdYear',t.ProgTo3rdYear)
,('ProgToCompleteQual',t.ProgToCompleteQual)
,('NotReturn2ndYr',t.NotReturn2ndYr)
,('NotReturn3rdYr',t.NotReturn3rdYr)
,('NotReturn4thYr',t.NotReturn4thYr)
) s (Status,StatusValue)
WHERE s.StatusValue = 1
April 15, 2014 at 7:24 am
;WITH a (ID,ImportGroup) AS (
SELECTc.ID,ROW_NUMBER() OVER (ORDER BY c.ID)
FROM@data c
LEFT JOIN @data n ON n.ID = c.ID + 1
WHERE(c.EventTypeID IN (1,2,4) AND n.EventTypeID in (0, 3))
OR(c.EventTypeID IN (0, 3) and...
April 14, 2014 at 8:44 am
After just perusing the query I do not think you will be able to split it in two, it is too large.
Even after replacing tab and crlf with space and...
April 14, 2014 at 6:37 am
miles_lesperance (4/11/2014)
April 12, 2014 at 5:57 am
sunil.mvs (4/11/2014)
April 12, 2014 at 5:45 am
use this expression
=IIF(Sum(CDec(Fields!Field2.Value))=0,0,Sum(CDec(Fields!Field1.Value))/IIF(Sum(CDec(Fields!Field2.Value))=0,1,Sum(CDec(Fields!Field2.Value))))
and set the format to P2
*Edited to include CDec
You should change your code to not use strings for numeric input
April 11, 2014 at 10:30 am
GilaMonster (3/24/2014)
March 25, 2014 at 2:42 am
If you are using ID for the join you will get a Cartesian result.
How do you know which row in table b belongs to each row in table a?
February 14, 2014 at 7:30 am
;WITH cte (CustId,OrderId,OrderDate,RowNumber) AS (
SELECT CustId,OrderId,OrderDate
,ROW_NUMBER() OVER (PARTITION BY CustId,YEAR(OrderDate),MONTH(OrderDate) ORDER BY YEAR(OrderDate),MONTH(OrderDate))
FROM
)
SELECT CustId,OrderId,OrderDate,SIGN(RowNumber)-SIGN(RowNumber-1) AS [CountUnique]
FROM cte
February 14, 2014 at 7:17 am
As already stated fix the problem at source.
Probable cause of 'joining' lines is missing CR char ie LF instead of CRLF
If this is the case delimit on LF and remove...
February 14, 2014 at 6:51 am
Viewing 15 posts - 811 through 825 (of 3,543 total)