Archive

Archive for November, 2010

Define Name Range In Excel 2007

November 14, 2010 Leave a comment

A Named Range is way to describe your formulas. So you don’t have to have this in a cell

= SUM(B2:B4)

You can replace the cell references between the round brackets. You replace them with a descriptive name, all of your own. So you could have this, instead:

= SUM(Monthly_Totals)

Behind the Monthly_Totals, though, Excel is hiding the cell references. We’ll see how it works, now.

Open up Excel 2007, and create the spreadsheet below:

The formula is in cell B5, and just adds up the monthly totals in the B column.

Define a Name

Setting up a Named Range is a two-step process. You first Define the Name, and then you Apply it. To Define your name, do this (make sure you have the formula in cell B5):

  • Highlight the cells B2 to B4 (NOT B5), then click the Formulas menu
  • Locate the Named Cells panel
  • Click Name a Range

From the Name a Range menu, click Name a Range :

You’ll then get the following dialogue box:

 

Click OK on the New Name dialogue box. Notice that the Name is our heading of Monthly_Totals.

When you click OK, you’ll be returned to your spreadsheet. You won’t see anything changed. But what you have done is to Define a Name. You can now Apply it.

Apply a Name

To apply your new Name, click into cell B5 where your formula is, and do this:

  • On the Named Cells panel, Click Name a Range
  • From the menu, select Apply Names
  • From the Apply Names dialogue box, select the Name you want and click OK:

 

When you click OK, Excel should remove all those cell references between the round brackets, and replace them with the Name you defined:

In the image above, cell B5 now says:

=SUM(Monthly_Totals)

The cell references have been hidden. But Excel still knows about them – it’s you that can’t see them!

Categories: Excel Tags:

Triger Sql Server – Delete Related data on others Table

November 14, 2010 Leave a comment

Triger bisa digunakan untuk menghapus data pada tabel yang lain tanpa lewat program aplikasi.

contaoh Triger :

CREATE TRIGGER MyTriger ON MRM_DATA
FOR DELETE
AS
DECLARE @intRowCount int
SELECT @intRowCount = @@RowCount
IF @intRowCount > 0
BEGIN
DELETE MRM_IR_RATES
WHERE DATA_ID IN (SELECT DATA_ID FROM deleted)
DELETE MRM_GOV_ZERO_RATES
WHERE DATA_ID IN (SELECT DATA_ID FROM deleted)
DELETE MRM_FXO_VOLS
WHERE DATA_ID IN (SELECT DATA_ID FROM deleted)
DELETE MRM_FX_RATES
WHERE DATA_ID IN (SELECT DATA_ID FROM deleted)
DELETE MRM_FIS_PRICES
WHERE DATA_ID IN (SELECT DATA_ID FROM deleted)
DELETE MRM_CORP_ZERO_RATES
WHERE DATA_ID IN (SELECT DATA_ID FROM deleted)
END
GO

Categories: SQL Server Tags: ,

Resed a SQL Server Identity Column

Kita bisa menggunakankan Query Berikut :

DBCC CHECKIDENT

(

‘TABLE_NAME’ , RESEED , 1

)

Categories: SQL Server

Mencari Titik Potong 2 Buah Garis Menggunakan Gradien

garis #1 melalui (a,b) dan (c,d)

garis #2 melalui (p,q) dan (r,s)

gradien garis #1 adalah

m1 = (b-d)/(a-c)……………………(1)

persamaan garis #1

y – y1 = m1 (x – x1)

y – b = m1 (x – a)………………….(2)

gradien garis #2 adalah

m2 = (q-s)/(p-r)…………………….(3)

persamaan garis #2

y – y2 = m2 (x – x2)

y – q = m2 (x – p)………………….(4)

persamaan (4) dikurangi persamaan (2)

b – q = (m2 – m1)x + (m1a – m2p)

x = {(b – q) – (m1a – m2p)}/(m2 – m1)……………..(5)

y = m2 (x – p) + q……………………(6)

titik potong kedua garis di (x,y)

contoh
(a,b) = (1,1)
(c,d) = (5,5)
(p,q) = (1,5)
(r,s) = (5,1)

dari persamaan (1)…….m1 = (1-5)/(1-5) = 1

dari persamaan (3)…….m2 = (5-1)/(1-5) = -1

dari persamaan (5)…….x = {(1 – 5) – (1*1 – (-1)*1)}/(-1 – 1)

…………………………….x = 3

dari persamaan (6)…….y = -1*(3 – 1) + 5 = 3

jadi jawaban yang diminta adalah (3,3)

Categories: Math Tags: