Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
17%
200 - 500 GB
17%
500 - 800 GB
6%
800 - 1200 GB
6%
1200 - 1500 GB
17%
1500 - 2000 GB
17%
> 2000 GB
22%
Total votes: 18

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 7th April 2008, 11:37
Hiba_t Hiba_t is offline
Senior Member
 
Join Date: Dec 2001
Posts: 117
Hiba_t is on a distinguished road
Baan: BaanIV & BaanERP & LN - DB: SQL server - OS: Windows 2000
Insert Record to a Table Dynamically
Baan: ERP LN 6.1
C/S: None/Unknown

Hi all,

I need to insert a record to a table programmatically. The table might not exist in the database and that's why I need to do the insert dynamically.

I have used dynamic sql before, but I didn't succeed in using it to insert a record to a table.

I searched the board but didn't find the solution.

Can anyone guide me how to do such a thing?

Thanks in advance,
Hiba
Reply With Quote
  #2  
Old 7th April 2008, 13:46
günther günther is offline
Guru
 
Join Date: Jan 2002
Location: Ehingen, Germany
Posts: 576
günther is on a distinguished road
Baan: IVc4 - DB: Informix - OS: HP-UX
Quote:
Originally Posted by Hiba_t View Post
The table might not exist in the database...
That's not possible for baan. You must create a table before you can use it.

There is a function db.create.table(), but I haven't tried it yet.

Günther
Reply With Quote
  #3  
Old 8th April 2008, 07:27
Hiba_t Hiba_t is offline
Senior Member
 
Join Date: Dec 2001
Posts: 117
Hiba_t is on a distinguished road
Baan: BaanIV & BaanERP & LN - DB: SQL server - OS: Windows 2000
It seems that I didn't make myself clear enough.

My program will run on several baan servers and some of these servers has this table in this their database and some don't have it. Only when this table exists I need to insert data to it. When it doesn't exist the program will do other actions and it won't create the table.

That's why I need to do the insert dynamically.

- Hiba
Reply With Quote
  #4  
Old 8th April 2008, 08:00
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,066
NPRao will become famous soon enough
Baan: Baan 4-5,5.2(Reger),LN-6.1,Infor LN-10.x - DB: Oracle,MS-SQL - OS: HPUX, Linux, Windows
Quote:
My program will run on several baan servers and some of these servers has this table in this their database and some don't have it. Only when this table exists I need to insert data to it. When it doesn't exist the program will do other actions and it won't create the table.
Refer to the dynamic SQL example - Dynamic SQL and also the thread - Check Table in Company

Add another case section for sql.fetch() for 506 or ENOTABLE and write your other action code there.
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao
Reply With Quote
  #5  
Old 8th April 2008, 08:04
Hiba_t Hiba_t is offline
Senior Member
 
Join Date: Dec 2001
Posts: 117
Hiba_t is on a distinguished road
Baan: BaanIV & BaanERP & LN - DB: SQL server - OS: Windows 2000
Can you please give me a simple example on how to write a dynamic sql to insert data into a table?

This is the part that I have a problem with.
Reply With Quote
  #6  
Old 8th April 2008, 08:12
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,066
NPRao will become famous soon enough
Baan: Baan 4-5,5.2(Reger),LN-6.1,Infor LN-10.x - DB: Oracle,MS-SQL - OS: HPUX, Linux, Windows
Hiba,

I'm not in office now. Here are 2 threads for reference to start with -

sql.parse and make a update???

Advanced programming.
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao
Reply With Quote
  #7  
Old 8th April 2008, 09:30
Hiba_t Hiba_t is offline
Senior Member
 
Join Date: Dec 2001
Posts: 117
Hiba_t is on a distinguished road
Baan: BaanIV & BaanERP & LN - DB: SQL server - OS: Windows 2000
Thanks a lot NPRao...

I guess I missed these threads in my search
Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Product Configurator Constraints w/ 4gl fosterjr Manufacturing & Supply Chain 11 29th January 2015 14:03
how to insert record in baan table ncgjiju Tools Development 18 29th May 2009 11:52
Tables used for MRP and PRP. BurghMan Tools Development 1 10th February 2005 14:08
Insert record in table: not work mostrightfuture Tools Development 3 29th November 2004 10:43
copy records c_siek Tools Development 9 18th June 2004 15:43


All times are GMT +2. The time now is 00:54.


©2001-2018 - Baanboard.com - Baanforums.com