Search

Wednesday, March 25, 2009

Stored Procedure Parameter Builder

One of the most common things we do is encapsulate the CRUD (Create Retrieve Update Delete) functions in a stored procedure. For tables with a lot of columns, typing in parameters to be used for Insert and Update stored procedures gets tedious. The solution is to build a generator for these parameters based from table columns. SQL can help us with this. Below is the code for a parameter builder:



create proc _parambuilder
@TableName varchar(100)
as

select ',@' + COLUMN_NAME + ' ' + DATA_TYPE + COALESCE('(' + LTRIM(STR(CHARACTER_MAXIMUM_LENGTH)) + ')', '')
from information_schema.columns
where table_name = @TableName



It will produce an output like

,@CustomerID varchar(15)
,@SiteID int
,@UserID int
,@CreatedBy varchar(50)
,@CreatedByDate datetime
,@LastUpdatedBy varchar(50)
,@LastUpdatedByDate datetime



All we have to do is remove the first comma and these parameters are good as copy and paste. This script can be customized to generate Insert and Update scripts.

Thursday, February 5, 2009

Korean Language Notes

My notes are kind of messy because I compiled it from a bunch of scratch papers. My tools for compiling in word are Korean Language pack for Windows XP and Babelfish translator (http://world.altavista.com). For the list of official romanization of Korean language I like to refer to Official Site of Korea Tourism Org: Romanization of Korean.

Korean

Romanized

pronounced

English

선생님

Seon.saeng.nim

seonsaengnim

teacher

학생

Hak.saeng

haksaeng

student

사람

Sa.ram


Person

좋아해요

Joh.a.hae.yo

Johahaeyo

Like

사과

Sa.(g,k)wa

sakwa

Apple

자동차

ja.dong.cha

jadongcha

Automobile/car

차

cha

cha

car

당신

Tang.sin

tangshin

You

나는

Na.neun

Naneun

I

저는

Cheo.neun

cheoneun

I

눈

Nun


Eye/snow

책

Chaek

chaek

Book

읽

Ilk

Ilk

read

책갈피

Chaek-kal-pi

chaekalpi

bookmark

집

Jip

Jip/chip

House

말할수

Mar.har.su

marharsu

Can (su) speak (marhar)

고양이

(g,k)o.yang.i

Goyang.i/Koyang.i

Cat

꽃

Kkoch

Kkott

Flower

문

Mun


Door

피

Pi


Blood

화장실

Hwa.jang.sil

hwajangshil

Toilet

사무실

Sa.mu.shil

samushil

office

실업가

Sa.eop.ka

Saeopka

businessman

비서

Bi-seo

Biseo

secretary

변호사

Byeon-ho-sa

Pyeonhosa

Lawyer

회사원

Hoe-sa-won

Wei-sa-won

Employee, business unit

비싸

Bi-ssa

bissa

expensive

학교

Hak-gyo

hakgyo

school

여자

Yeo-ja

yeoja

woman

남자

Nam-ja

Namja

man

자전거

Ja-jeon-keo

jajeonko

bike

아름다운

a-reum-da-un

Areumda-un

beautiful

거지

Keo-ji

Keoji

beggar

부자

Bu-ja

buja

Rich man

간

Gan

gan

liver

역사

Yeok-sa

Yeoksa

history

북쪽

Puk-jjeuk

Pukjjeuk

north

동쪽

Dong-jjeuk

Dongjjeuk

east

남쪽

Nam-jjeuk

Namjjeuk

south

서쪽

Seo-jjeuk

Seo-jjeuk

west

북한

Puk-han

Pukhan

North Korea

남한

Nam-han

Namhan

South Korea

가지계절

Ka-ji-kyeo-jeol

kajikyeojeol

4 seasons (??)

새

sae

sae

Bird

새싹

Sae-ssak

saessak

buds

년

Nyeon

Nyeon

Year

월

Wol

Wol

Month

주

Ju

Ju

Week

일

Il

Il

Day

시간

Si-gan

Shigan

Hour

분

Pun

Pun

Minute

초

Cho

Cho

second

온도

On-do


Temperature (Celsius)

온

don


Money

해

Hae


Sun

해병

Hae-byeong


beach

봄

bom


Spring

여름

Yeo-reum


Summer

가을

ga-eul


Autumn

계울

Kyeo-ul


Winter

자기

jagi

Jagi

Honey, darling

다시

dashi

dashi

Again

1. 나는 ____ 에 되고 싶는다. Naneun ____ e doego ship neun da. (I want to be a ____.)

나는 변호사에 되고 싶오요. Naneun byeonhosa e shipneunda. (I want to be a lawyer.)

2. 나는신발이비싸요 Naneun shinpari pissa yo. (My shoes are expensive.)

3. 물주세요Mul juseyo (Give me water please?)

Mul yogi yo (Here is water)

4. Cheongmaneyo (Don’t mention it/You’re welcome)

5. Naneun Hankuk reul malhal su iss seupnida. (I can speak Korean)

(I) (Korean) (pp) (speak) (can) (it is)

6.

나는척을읽여요 Naneun chaek eul ilgayo (I read books)

나는 책을 읽었다 Naneun chaek eul ilk eoss da (I read books)

7. Cheoneun cha ga opseoyo (I do not have a car)

8. Pi ga wayo (It’s raining)

9. Cheonun teulge i nun eul kachiguseyo (I have two eyes)

10. Cheoneun tari ga teulge isseoyo (I have 2 legs)

11. 여자가아름다운입니다 Yeojaga a-reum-da-un ipnida (Girls are beautiful)

12. Naneun kan i han isseoyo (I have one liver)

13. Pisshi manayo kureso keoji eyo (I have a big debt so I am a beggar)

[Pisshi (debt) manayo (big) kureso (so) keoji (beggar)]

14.들으십시요 Deureu shipshiyo (listen)

15. Naneun Hankuk mari oryowoyo (?? I find Korean difficult to speak)

16.

2008 년

Year 2008

2 월

February

2 주

2nd week

15일

15th day

12 시간

12 hour (12 o clock?)

30분

30 minutes

15초

15 seconds

12 시간30분15초 = 12:30:15 am??

17. 다시말해주세요Tashi malhae juseyo (Please say it again) [Tashi (again) malhae (say)]

18. Naneun namjaga animnida. (I am not a boy)

19. 오분간휴식

Obungan hyushik (Five minute break) [Obun (five minutes) gan (for) hyushik (rest/break)]

20. 자신감을갖자 Jashinkameul ka-ja (Be confident)

21. 당신은 소중한사람입니다 Tangshin-eun sojunghan saram ipnida (You are a precious person)

자신감을갖자. 당신은 소중한사람입니다

Be confident. You are a precious person

Tangshin-eun (You) sojunghan (precious/adjective) saram (person/s.c.) ipnida (is/verb)

22. 시간은금입니다 Shigan-eun geum ipnida (Time is gold)

Shigan (time) geum (gold/s.c.)

23. 늦지마세요 Neutji ma seyo (Don’t be late)

24. 빨리와 Ppalli wa /빨리오세요 Ppalli oseyo (polite) => Hurry up

25. Abeoji donjuseyo. Jadongcha reul saryeokoyo. (Dad please give me money. I will buy a car.)

Saryeokoyo => I will buy