Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Updated :Count and find last Occurrence of value ?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 01/28/2013 :  08:40:52  Show Profile  Reply with Quote
Below you will see that I have manually found the last occurrence of each value for each row. Each row will be scanned for the same 0-9 MB until last occurrence is found. What would be the best way to automate this ? If you manually count what each column name in "green" is searching for you will see my objective. Example would be 1MB column is searching for 1MB.

NOTE "Green" columns are searching for the last occurrence of that specific column name in "ANY" "Pink" column. Example Column 4MB will search Server1,Server2,Server3 per row until last occurrence of 4MB is found.

Any help would be greatly appreciated. Thanks
[Date] [date]
[Server1] [nvarchar](25)
[Server2] [nvarchar](25)
[Server3] [nvarchar](25)
[0MB] [int](5)
[1MB] [int](5)
[2MB] [int](5)
[3MB] [int](5)
[4MB] [int](5)
[5MB] [int](5)
[6MB] [int](5)
[7MB] [int](5)
[8MB] [int](5)
[9MB] [int](5)


Edited by - MSSQLRahzel on 01/28/2013 14:31:09

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/28/2013 :  08:48:50  Show Profile  Reply with Quote
looks like pivotting to me

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000