Viewing 15 posts - 721 through 735 (of 1,496 total)
Hi Iain,
Thanks for the performance comparison.
We both seem to expect the quirky update to run faster. As it is non-relational I prefer to let people use their own judgement on...
October 19, 2011 at 11:42 am
Sunny,
If you want the groups to show then:
1. like Iain, I suspect the quirky update will be quickest.
The following article, by Jeff Moden, gives the details; you should read the...
October 19, 2011 at 10:10 am
You will need to watch boundary conditions, but try something like the following:
WITH EmpLoginTime
AS
(
SELECT EmpName
,ROW_NUMBER() OVER (PARTITION BY EmpName ORDER BY LoginTime) AS EmpOrder
,LoginTime
FROM dbo.logintime
)
,EmpTimes
AS
(
SELECT T1.EmpName, T1.EmpOrder, T1.LoginTime AS StartTime
,CASE
WHEN...
October 19, 2011 at 6:26 am
If you have space in tempdb, try using read commited snapshot isolation.
October 17, 2011 at 5:42 am
raphael.kong (10/10/2011)
In case of bulk insert, no trigger are fired, OK ; But, when the software insert data into the table (using the DSN) the trigger IS fired, as...
October 10, 2011 at 11:00 am
Assuming ID is the PK of stg_PAreporting:
WITH JobOrder
AS
(
SELECT ID
jobname
,jobname + '-' + CAST(ROW_NUMBER() OVER (PARTITION BY jobname ORDER BY [date]) AS varchar(3)) AS NewJobName
FROM stg_PAreporting
)
UPDATE JobOrder
SET jobname = NewJobName
October 6, 2011 at 6:08 am
Indexes on FinalOutput, like the following, may also help.
CREATE NONCLUSTERED INDEX FinalOutputProdNumTransDate
ON dbo.FinalOutput ([Product Number (SKU)], [Trans Date])
INCLUDE ([Seller - Company ID]);
CREATE NONCLUSTERED INDEX FinalOutputProdLineTransDate
ON dbo.FinalOutput ([Product Line ID], [Trans...
September 13, 2011 at 11:17 am
With some filtered covering indexes on dbo.PromoMaster
CREATE NONCLUSTERED INDEX FIPromoMasterSKUNotAll
ON dbo.PromoMaster (SKU, [Start Date], [End Date])
INCLUDE ([T1 ID], [Programe ID], [Promo Type], [Rebate Value])
WHERE SKU <> 'ALL';
CREATE NONCLUSTERED INDEX FIPromoMasterSKUAll
ON...
September 13, 2011 at 10:17 am
This will probably work but will not use any indexes:
UPDATE P
SET UPC = sourc.upc,
PROD_NAME = sourc.name,
...
September 9, 2011 at 9:43 am
You should be able to work out what you need to do in the first CTE.
August 30, 2011 at 5:34 am
DECLARE @CurrDate datetime;
SET @CurrDate = '20110831';
WITH CurrentWeek
AS
(
SELECT DATEADD(d, DATEDIFF(d, 0, @CurrDate) - DATEPART(weekday, @CurrDate) + 1, 0) AS WeekStart
,DATEADD(d, DATEDIFF(d, 0, @CurrDate) - DATEPART(weekday, @CurrDate) + 8, 0) As WeekEnd
)
,Years100
AS
(
SELECT...
August 30, 2011 at 5:09 am
In relational theory a relation (table, view etc) is an unordered set.
You should really alter your code so that the ORDER BY is on the outer most query.
If you are...
August 23, 2011 at 8:49 am
Maybe the cartisian product:
WITH Numbers(N)
AS
(
SELECT 0
UNION ALL SELECT 1
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION ALL SELECT 4
UNION ALL SELECT 5
)
SELECT
N1.N AS exid1
,N2.N AS exid2
,N3.N AS exid3
FROM Numbers N1
CROSS JOIN...
July 27, 2011 at 7:04 am
You asked a similar question before on this thread:
http://www.sqlservercentral.com/Forums/Topic1139620-145-1.aspx#bm1139686
I suggest you study the original thread so you understand what is happening.
July 19, 2011 at 9:57 am
Viewing 15 posts - 721 through 735 (of 1,496 total)