Viewing 15 posts - 6,151 through 6,165 (of 10,144 total)
Welsh Corgi (6/29/2012)
If I comment out the LEFT JOIN's I get 39,028 Records.With the LEFT JOIN's uncommented I get 26,0876 records.
And that's the exact same query that you...
June 29, 2012 at 7:06 am
Welsh Corgi (6/29/2012)
After I got the record COUNT correct I was going to incorporate an INSERT INTO with CASE...
June 29, 2012 at 6:29 am
Welsh Corgi (6/29/2012)
What is wrong with my statement and how can...
June 29, 2012 at 6:16 am
SQL Server will ignore both the TOP(100 percent) and the ORDER BY. You should reconsider what you are trying to do here.
June 29, 2012 at 4:44 am
_simon_ (6/29/2012)
@chrism-2@Work - that's it, thanks 🙂Is there any specific reason why you used dense_rank function? I tried with two row_number functions and it still works ok.
I'd be interested to...
June 29, 2012 at 3:03 am
This shouldn't be too difficult.
What does @PivotColumnHeaders look like?
Can you provide DDL for the two tables, with some sample data?
June 29, 2012 at 2:59 am
SELECT Username,
DateFrom = MIN([Date]),
DateTo = MAX([Date]),
CodeFrom = MIN(Code),
CodeTo = MAX(Code)
FROM (
SELECT Username, [Date], Code,
rn = ROW_NUMBER() OVER(ORDER BY Username, Code),
dr = DENSE_RANK() OVER(ORDER BY Code)
FROM @originalTable
)...
June 29, 2012 at 2:34 am
dwain.c (6/28/2012)
Jeff Moden (6/28/2012)
June 29, 2012 at 2:15 am
Phil Parkin (6/28/2012)
...ChrisM - think you've got some tuning to do 🙂...
It's awful isn't it! I don't think it can be improved either.
June 29, 2012 at 2:06 am
patrickmcginnis59 (6/27/2012)
ChrisM@Work (6/27/2012)
SET @STRSQL = 'INSERT INTO ' + @DB...
June 29, 2012 at 2:03 am
@CLASSIFICACAO is declared as an int, you have to cast it as a string type to concatenate it into the string:
SET @STRSQL = 'INSERT INTO ' + @DB + '.DBO.SINCRONISMO...
June 27, 2012 at 9:29 am
You should be able to figure it out from this:
SELECT x.months, [YYYYMM] = CAST(CONVERT(CHAR(6),Months,112) AS INT)
FROM (VALUES (0),(1),(2),(3),(4),(5),(6)) r (n)
CROSS APPLY (SELECT Months = DATEADD(mm,-n,GETDATE())) x
June 27, 2012 at 8:53 am
ramadesai108 (6/26/2012)
Create PROCEDURE [dbo].[MySP]
(
@OrgId int,
@DivId int = null,
@EmpId nVarChar(MAX) = NULL,
@year int
)
AS
DECLARE @sql nVARCHAR(MAX)
DECLARE...
June 27, 2012 at 8:43 am
Viewing 15 posts - 6,151 through 6,165 (of 10,144 total)