Thursday, 15 May 2014

Check the existence of the table when sql script runnnig first time (Advantage data architect) -



Check the existence of the table when sql script runnnig first time (Advantage data architect) -

good day.

i have next question:

is possible check existence of table when sql script running first time?

i'm using advantage info architect 11.10.

i want clarify question.

in script need create temporary table each time when sql script starting. delete temporary table , recreate table. illustration (1):

... if exists (select * #tmp) delete table #tmp; end if; create table #tmp (g integer); ...

but when run script first time next error:

the temporary table cannot found.

to prepare error, forced create temporary table "my hands". code showed in "for illustration (1)" worked without errors.

thanks.

sorry english.

one solution this:

try drop table #tmp; grab end try; create table #tmp ...

another solution:

if not exists (select 1 (execute procedure sp_gettables (null, null, 'tmp', 'local temporary')) gettables ) create table #tmp ... end if;

see here:

http://devzone.advantagedatabase.com/forum/questions/5573/determine-if-temp-table-exists

sql advantage-database-server

No comments:

Post a Comment