With Ties on SQL Server 2005 Monday, Mar 10 2008 

SQL Server 2005 has the functionality to select the top records but let’s say I want the same amount also will be loaded. For example, I’d like to select the top 5 currency rate records from a table, but if one of the records has the same value, don’t make it count as top 5. For illustrations you could see below example.

select top 5 * from batch where module = ‘CA’ order by curyrate desc

BatNbr CuryRate
000345 9900
000350 9900
000351 9900
000400 9800
000450 9750

If you look at that one, you will see that 9900 was loaded 3 times, let’s see if I run by below scripts.

select top 5 with ties * from batch where module = ‘CA’ order by CuryRate desc

BatNbr CuryRate
000345 9900
000350 9900
000351 9900
000400 9800
000450 9750
000451 9750
000475 9500
000456 9400

Could you see the difference?

LINQ in Vis Studio 2008 Monday, Mar 10 2008 

Fitur yang bagus sekali dari Vis Studio 2008 :) tapi saya belum explore lebih jauh apakah ini akan membebani memori untuk data yang besar. LINQ itu merupakan kepanjangan dari Language-Integrated Query, yang bahasa”nya really close to SQL. For example, I have a select script in SQL:

select * from Inventory where weight > 100

Kalo dengan LINQ, scriptnya adalah sebagai berikut:

let’s say sebelumnya saya sudah declare Table inventory dalam class Inventory

class Inventory

Private InvtID as string
Private Descr as string
Private weight as double
Private Dimension as doublePublic Property InvtID() as string
….
End Property

Public Property Descr() as string
….
End Property
…..

end class

Kemudian, saya initiate isi class itu,
Dim Inventory() = { _
New Inventory With {.InvtID = “001-ORD”, .Descr = “Ordner”, .Weight = 20, .Dimension = 100}, _
New Inventory With {.InvtID = “001-CONT”, .Descr = “Container”, .Weight = 220, .Dimension = 110}, _
New Inventory With {.InvtID = “001-PC”, .Descr = “PC Desktop”, .Weight = 150, .Dimension = 130} }

Dim WeightedInventory = From Invt In countries Where Invt.weight > 100 Select Invt

From Each Invt1 In WeightedInventory
Console.WriteLine(Invt1.InvtID)
Next

Ga beda jauh sih sebenernya, tapi kalo dibandingkan populate query di VB dengan SQL by stored procedure, which one is the best practice? Yang mana yang lebih tidak membebankan memory? Menurut hemat sya, sepertinya masih lebih bagus populate query di store procedure :)

Alhamdulillah Monday, Mar 10 2008 

Alhamdulillah [-o< I have passed first semester well :) All things that tortured me were paid, I’m on the fly right now :) Thanks to my dearest for all that you have helped me. Hopefully I’ll get the the same result or higher in the next semester. Keep guts :)

Tarot Monday, Mar 10 2008 

maen” blog temen, ada tentang tarot, paan tu, ikutan de :p

You are The Hermit

Prudence, Caution, Deliberation.

The Hermit points to all things hidden, such as knowledge and inspiration,hidden enemies. The illumination is from within, and retirement from participation in current events.

The Hermit is a card of introspection, analysis and, well, virginity. You do not desire to socialize; the card indicates, instead, a desire for peace and solitude. You prefer to take the time to think, organize, ruminate, take stock. There may be feelings of frustration and discontent but these feelings eventually lead to enlightenment, illumination, clarity.

The Hermit represents a wise, inspirational person, friend, teacher, therapist. This a person who can shine a light on things that were previously mysterious and confusing.

What Tarot Card are You?
Take the Test to Find Out.