µðºñ ÄÚµå °ü·Ã ¹®ÀÇ

GodokNam   
   Á¶È¸ 6059   Ãßõ 0    


안녕하세요? 제가 디비 백업을 받지 못하고 소스만으로 디비를 구성해야 되는 상황에 있습니다.
다음 구문을 통해
Dim da1 As New OdbcDataAdapter("select c_charge, c_phone, c_email, c_name, c_tel, ZIPCODE, c_add,
                                s_number, e_number, e_charge, e_phone, c_date, c_pay, c_serial" + _
                               "from company where (c_code =" & code_NO & ")", myConnection)

Dim da2 As New OdbcDataAdapter("select m.c_saluteTF as c_saluteTF, m.c_placeTF as c_placeTF,
                                m.c_holidayTF as c_holidayTF, m.c_businessTF as c_businessTF, m.c_salute1 as c_salute1,
                                m.c_salute2 as c_salute2, " + _ "m.c_place1 as c_place1, m.c_place2 as c_place2,
                                m.c_place3 as c_place3, m.c_place4 as c_place4, m.c_place5 as c_place5,
                                m.c_place6 as c_place6, m.c_place7 as c_place7, m.c_place8 as c_place8,
                                m.c_place9 as c_place9," + _ "m.c_holiday as c_holiday, m.c_lunch as c_lunch,
                                m.c_leaving as c_leaving, m.m_nurber as m_nurber, m.c_etc as c_etc " + _
                               "from company c JOIN ment m Using(c_code) where (c.c_code = " & code_NO & ")", myConnection)

Dim da As New OdbcDataAdapter("select c.c_code as c_code, c.c_name as c_name, c.c_charge as c_charge,
                               c.c_tel as c_tel, c.c_phone as c_phone, c.ZIPCODE as ZIPCODE, c.c_add as c_add,
                               c.c_email as c_email, s.s_name as s_name, c.c_date as c_date, " + _
                               "e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone, c.c_pay as c_pay" + _
                               " from company c JOIN service s Using(s_number) JOIN equipment e Using(e_number)
                              order by c.c_code desc;", myConnection)
 
Dim da As New OdbcDataAdapter("select c.c_code as c_code, c.c_name as c_name, c.c_charge as c_charge,
                             c.c_tel as c_tel, c.c_phone as c_phone, c.ZIPCODE as ZIPCODE, c.c_add as c_add,
                             c.c_email as c_email, s.s_name as s_name, c.c_date as c_date, " + _
                              "e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone" + _
                              " from company c JOIN service s Using (s_number) JOIN equipment e Using(e_number) where
                             c.c_date between '" & lastweek & "%' and '" & tomorrow & "%'order by c.c_code desc;", myConnection)

Dim da As New OdbcDataAdapter("select c.c_code as c_code, c.c_name as c_name, c.c_charge as c_charge,
                              c.c_tel as c_tel, c.c_phone as c_phone, c.ZIPCODE as ZIPCODE, c.c_add as c_add,
                              c.c_email as c_email, s.s_name as s_name, c.c_date as c_date, " + _
                               "e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone" + _
                               " from company c JOIN service s Using (s_number) JOIN equipment e Using(e_number) where
                             c.c_date between '" & lastmonth & "%' and '" & tomorrow & "%'order by c.c_code desc;", myConnection)
 
Dim infoSql As String = "insert into company(c_charge,c_phone,c_email,c_name,c_tel,ZIPCODE,c_add,s_number,
                                  e_number,e_charge,e_phone,c_date,c_pay) values ('" _
                                 & charge & "','" & phone & "','" & email & "','" & company & "','" & tel & "','" & post & "',
                                 '" & add & "'," & model & "," & equipment & ",'" & e_charge & "','" & e_phone & "',SYSDATE(),false);"
 
Dim mentSql As String = "insert into ment values (" & code & ",'" & ment1_CHK & "','" & ment2_CHK & "',
                                   '" & ment3_CHK & "','" & ment4_CHK & "','" & salute1 & "','" & salute2 & "','" _
                                    & place1 & "','" & place2 & "','" & place3 & "','" & place4 & "','" & place5 & "','" & place6 & "',
                                   '" & place7 & "','" & place8 & "','" & place9 & "','" _
                                   & holiday & "','" & lunch & "','" & leaving & "'," & music & ",'" & etc & "');"
 
아래와 같이 테이블을 구성하였습니다.
< company > 테이블
------------------------------------------------------------------------------------------------------------------
c_code  c_charge  c_phone  c_email  c_name  c_tel  ZIPCODE  c_add  s_number  e_number  e_charge  e_phone  c_date  c_pay  c_serial
----------------------------------------------------------------------------------------------------------------------
< ment > 테이블
--------------------------------------------------------------------------------------------------------------------
c_code c_saluteTF c_placeTF c_holidayTF c_businessTF c_salute1 c_salute2 c_place1 c_place2 c_place3 c_place4 c_place5 c_place6 c_place7 c_place8 c_place9 c_holiday c_lunch c_leaving m_nurber c_etc
----------------------------------------------------------------------------------------------------------------------
< service > 테이블
-----------------------------------------
s_number s_name
-----------------------------------------
< equipment > 테이블
-----------------------------------------
e_number e_name e_charge e_phone
-----------------------------------------
그러나 위 구문을 보면 Foreign key도 설정해 줘야 할것 같은데(JOIN을 사용하는 것으로 보아) 디비를 십 몇년만에 처음 접하다 보니 어렵네요.
물론 위 구문만으로는 어려울것으로(줄바꿈으로 인해 보기에도 어렵네요) 알지만 혹시나 하는 마음에
위 테이블의 외부키를 어떻게 설정해야 되는지 도움을 청해도 될까요?
 
감사합니다.
ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
AKs 2013-06
Å°´Â »ðÁú Á» ÇÏ¸é ´ëÃæ ¸¸µé ¼ö ÀÖÀ» °Í °°Àºµ¥...
¹®Á¦´Â µ¥ÀÌÅÍ ÇüÀº ÀüÇô ¾Ë ¼ö ¾øÀ¸´Ï... ¾î·Æ°Ú³×¿ä.
     
GodokNam 2013-06
¾Æ·¡ µÎ insert ±¸¹®À» ÅëÇØ µðºñ¿¡ ÀúÀåÀº Çߴµ¥ ¼¼¹ø° select ¹®À» ÅëÇØ µ¥ÀÌÅ͸¦ °¡Á®¿À¸é ¾Æ¹«°Íµµ ¾È ³ª¿É´Ï´Ù. ¼Ò½º¸¦ ¾Æ¹«¸® µÚÁ®ºÁµµ service³ª equipment Å×ÀÌºí¿¡ insert ÇÏ´Â ±¸¹®ÀÌ ¾ø¾î¿ä. µ¥ÀÌÅÍ ÇüÀº óÀ½ row °ª¸¸ int ÇüÀ¸·Î ÇÏ°í ³ª¸ÓÁö´Â ´Ù stringÀ¸·Î Çß½À´Ï´Ù.(Àúµµ µ¥ÀÌÅÍ ÇüÀ» ¾ËÁö ¸øÇϱ⠶§¹®¿¡.. ÂÁ..)
     
GodokNam 2013-06
°¢ Å×ÀÌºí¿¡ Áߺ¹µÇ´Â À̸§ÀÌ Àִµ¥ ±× µÎ°³ÀÇ µ¥ÀÌÅÍ ÇüÀ» ÀÏÄ¡½ÃÅ°¸é ¾î´À Á¤µµ ¾Ë ¼ö´Â ÀÖ°ÚÁö¿ä?
±è¹®Çü 2013-06
ERWin °°Àºµ¥ Áý¾î ³Ö¾î¼­ °ü°èÇüÀ¸·Î »ì¦ º¸½Ã´Â°Ô ºü¸¦°Í °°½À´Ï´Ù.
¹°·Ð µ¥ÀÌÅÍ Çü À̸§ ´Ù ³ª¿À´Ï °í¹Î ÇϽÃÁö ¸»°í È× µ¹·Á¼­ Àâ¾Æ º¸½Ã°í ¿¬°á ½ÃÅ°½Ã¸é µÉ°Í °°½À´Ï´Ù¸¸.
DB ¹é¾÷º»À» ¸ø ¹ÞÀ¸½Ã´Â°Ô Á¢±ÙÀ» ÇÒ ¼ö °¡ ¾ø¾î¼­ ÀÎÁö »çÁ¤À» Àß ¸ð¸¨´Ï´Ù¸¸.
Àú´Â PowerBuilder¸¦ ÁÖ·Î »ç¿ëÇÕ´Ï´Ù ÀÌ°Ç ÇÁ·Î±×·¥ °³¹ßµµ µÇÁö¸¸ »ì¦ DB µðÀÚÀ̳ʿ¡¼­ °°´Ù ºÙÀÌ¸é º¸±â ÆíÇÏ°Ô ³ª¿Í¼­ ¸»ÀÔ´Ï´Ù.


QnA
Á¦¸ñPage 1922/5691
2014-05   5016484   Á¤ÀºÁØ1
2015-12   1551939   ¹é¸Þ°¡
2005-08   6060   Á¤Ä¡¹Î
2005-04   6060   °èÀ¯Âù
2006-04   6060   ¼­´ö¿­
2005-06   6060   ±è¿ìÅÃ
2009-06   6060   ÇÁ·ª
2007-09   6059   ¹ÚÇö±Ù
2009-11   6059   ȲȥÀ»ÇâÇØ
2012-04   6059   ¹Ì¼ö¸Ç
2016-10   6059   Nammu
2012-12   6059   ±¸¸í¼­
2005-06   6059   ±èÀǽÂ
2011-09   6059   ¶Ñ¶Ñ±è´ë¿ø
2011-09   6059   ¹Ì¼ö¸Ç
2020-06   6059   2CPUI±è¼¼ÈÆ
2009-04   6059   ÀÌ¿µ±Ô
2005-04   6059   ±è¿øÀÏ
2006-04   6059   ¹ÚÁرÔ
2011-09   6059   ¿©ÁÖÀÌ»óµ·
2005-07   6059   ÀÌ»ó·æ
2014-12   6058   µ¿È­¼Ó±×¸²