Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Losing data in temp tables (Dexterity/GP)

Posted on by 25

Hi,

Is there a way to use temp tables in global procedures without losing data? I am currently developing a procedure that will be called by a 3rd party, which should populate temp tables then call several other procedures that will use that temp tables data... And I have to do this without opening any window/form... The problem is, the moment I call a "sub" procedure within my "main" procedure, the data within the temp tables are gone... Is there a way around this?

I tried using permanent "temp" tables but I'm not sure if this is efficient because this would mean actually creating physical tables into SQL...

Any ideas would be appreciated...

Thanks,

Francis 

 

 

 

 

*This post is locked for comments

  • Francis Ang Profile Picture
    Francis Ang 25 on at
    Re: Re: Losing data in temp tables (Dexterity/GP)

    Thanks for the reply dpitcher... But, I am thinking more towards the temp table defined in Dexterity... See, I defined a few tables in Dexterity with a physical name of "temp"... this made them temporary tables... Unfortunately, when I populate them within a global procedure/script written in Dexterity, the data is lost whenever I make another procedure call within that global procedure/script... Is there a way around this? I already have Dex reports made that is "connected" to those temp tables and by the time I run the report, the data is gone...

    Thanks,

    Francis 

     

  • dpitcher Profile Picture
    dpitcher 200 on at
    Re: Losing data in temp tables (Dexterity/GP)

    There are 2 types of temp tables in SQL, local and global. Local temp tables are only usable by the session that creates them.  Global temp tables can be referenced by other sessions. 

    This creates a local temp table: CREATE TABLE #TableName (list of fields)

    This creates a global temp table: CREATE TABLE ##TableName (list of fields)

    Keep in mind even temp tables are "physical tables", they're created in the tempdb database.  Typically you want to avoid using them if you can but obviously there are situations that require them. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans