Viewing 15 posts - 1 through 15 (of 35 total)
DECLARE @RegionCounts Table
(
TYear char(2),
Region varchar(30),
RowCnt int
)
Insert into @RegionCounts values ('13','Latam',100)
Insert into @RegionCounts values ('13','NOAM',200)
Insert into @RegionCounts values ('14','Latam',300)
Insert into @RegionCounts values ('14','NOAM',400)
select * from @RegionCounts
May 23, 2019 at 3:01 pm
Thank you all for your comments and solutions. I was able to solve my problem as below.
In the procedure, used row_number to generate row numbers within the group by...
September 12, 2018 at 12:23 pm
No. do not want the sum of qtySent.
There will be bunch of other columns like DispatchDate, Location for each of those rows which have different values per row.
September 12, 2018 at 9:40 am
Super..!! This works exactly, as needed. Thank you.
February 6, 2017 at 9:26 am
You can do a batch delete of the rows, in the batch increments.
USE AdventureWorks2008R2;
GO
--Delete in batches of 10000 rows
While @@ROWCOUNT <> 0
DELETE Top 10000 * FROM Purchasing.PurchaseOrderDetail
WHERE DueDate =...
July 5, 2016 at 12:42 pm
Jeff, Here is the code for split function..
CREATE FUNCTION [dbo].[Split] (@sep VARCHAR(32), @s-2 VARCHAR(MAX))
RETURNS @t TABLE
(
val...
January 8, 2014 at 1:40 pm
The solution from MelroyV, worked for me. Thanks a lot, melroy.
Thank you Sean for your inputs/suggestions.
Your suggested solution was close too, but I was looking for traversed results....
January 8, 2014 at 9:48 am
The query worked. Made a minor modification, and it gave me the desired results.
SELECT itemNoAS Item,
CatAS CatID,
SubCatAS SubCatID
FROM #Test
CROSS APPLY( VALUES
( Cat1, SubCat11),
( Cat1, SubCat12),
( Cat2, SubCat21),
(...
August 21, 2013 at 7:26 am
Thank you very much. The solution worked, and this was exactly what I was looking for..!!
March 15, 2013 at 11:16 am
Thank you very much. The script worked pretty well, on my actual tables with minor tweaking.
March 13, 2012 at 2:55 pm
How about using row_number() over (order by Userid) as rownum, and do an order by on this Row Num.
March 13, 2012 at 1:36 pm
My Actual tables has more than 50 columns, of which only 3 columns needs to be distinct, on any row, and has many data rows. Tried to simulate the problem...
March 13, 2012 at 1:25 pm
Viewing 15 posts - 1 through 15 (of 35 total)