PROCEDURE to connect another database

Discussion forum about all things SqlBase.
soni
India
Posts: 37
Joined: 07 Jul 2020, 13:24
Location: hyderabad, India

PROCEDURE to connect another database

Post by soni » 14 Apr 2021, 05:35

how to write a procedure to connect another database and insert a row into a table in it.
please anyone van help

soni
India
Posts: 37
Joined: 07 Jul 2020, 13:24
Location: hyderabad, India

Re: PROCEDURE to connect another database

Post by soni » 14 Apr 2021, 08:36

soni wrote:
14 Apr 2021, 05:35
how to write a procedure to connect another database and insert a row into a table in it.
please anyone van help
Set bOk = SqlStore( hSql, 'SP_ACCOUNTS_MOD', "PROCEDURE: PR_SP_ACCOUNTS_UPD static
PARAMETERS
String: spRowid
String: spType
LOCAL VARIABLES
Sql Handle: hSqlInsert
String: sInsert
ACTIONS
Set SqlDatabase = 'TRAIL'
Set SqlUser = 'SYSADM'
Set SqlPassword = 'SYSADM'
Call SqlConnect ( hSqlInsert )" )


when am using SqlDatabase or SqlUser or SqlPassword , it gives an error, undefined variable.
can we user SqlDatabase or SqlUser or SqlPassword predefined variables in PROCEDURE???

User avatar
Steve Leighton
Site Admin
Site Admin
New Zealand
Posts: 274
Joined: 05 Mar 2017, 20:57
Location: Tauranga, New Zealand <--> Stroud, England

Re: PROCEDURE to connect another database

Post by Steve Leighton » 15 Apr 2021, 02:24

.
TeamDeveloper system variables ( such as SqlDatabase, SqlUser ... ) are not supported in SQLBase - they are TeamDeveloper variables. SQLBase does not know about them.
Only SAL functions are common to TD and SQLBase ( SqlPrepare() , SqlFetchNext()... )

If you want to execute a Stored proc or command on a different database, connect to it first in your TD app, then run it with SqlRetrieve()...

Go here and read 'SQLBase Language Reference' https://samples.tdcommunity.net/index.p ... ase_Books/ which we very kindly maintain through the goodness of our hearts at no extra cost :D .
Greetings from New Zealand
Steve Leighton

Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand

www.banksidesystems.co.uk

Image

soni
India
Posts: 37
Joined: 07 Jul 2020, 13:24
Location: hyderabad, India

Re: PROCEDURE to connect another database

Post by soni » 02 Sep 2021, 05:13

Steve Leighton wrote:
15 Apr 2021, 02:24
.
TeamDeveloper system variables ( such as SqlDatabase, SqlUser ... ) are not supported in SQLBase - they are TeamDeveloper variables. SQLBase does not know about them.
Only SAL functions are common to TD and SQLBase ( SqlPrepare() , SqlFetchNext()... )

If you want to execute a Stored proc or command on a different database, connect to it first in your TD app, then run it with SqlRetrieve()...

Go here and read 'SQLBase Language Reference' https://samples.tdcommunity.net/index.p ... ase_Books/ which we very kindly maintain through the goodness of our hearts at no extra cost :D .
thankyu...above idea is good , but procedure will exceute using a trigger, so i need a connection from sqlbase itself not through TD app. so any idea on how to connect to different database inside the procedure

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests