1. Frank Zettanucci
  2. PowerBuilder
  3. Thursday, 2 February 2023 19:29 PM UTC

Whenever I go into the database painter for a microsoft sql server profile, its active and connected, but when i click on tables the list of tables wouldnt retrieve it would just sit there grinding away retrieving tables ... but nothing showing,

Turns out there was a SCH-M lock on the DB caused by a SP call that was doing a retrieve into a # tmp table

The SP did not explicitly drop the temp table because I think the SQL Server dynamically names the tmp table so multi-users can be running the SP at the same time however, it would cause PB db painter to be unable to retrieve the table list because it would get blocked by that Sch-M locking block

Would there be a way around this where i could have a simple SP creating a #temptable and when it exits the stored procedure it doesnt cause such a issue,

A connection parameter maybe or something in the SP itself i could write or what?

I have temporarily removed the use of the tmp table and do just a straightup select but the purpose of the SP was so i could do a few different actions on the initial results and then finalize a single final select to return using the modified tmp table resultset to the datawindow with the last results

any ideas or suggestions?

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 6 February 2023 07:10 AM UTC
  2. PowerBuilder
  3. # 1

Doesn't the SP drops the temp tables created at the end of the SP?  
Drop Table #temp1 ;

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Frank Zettanucci Accepted Answer Pending Moderation
  1. Friday, 3 February 2023 19:09 PM UTC
  2. PowerBuilder
  3. # 2

sometimes i just want a quick peek at the table names and sometimes check a column quick instead of swapping out to enterprise studio manager or dbartisan ...  i dont actually write any sql in PB thats very rare actually however

 

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 2 February 2023 21:50 PM UTC
  2. PowerBuilder
  3. # 3

Hi Frank;

   Anytime any program, SP, SF, etc uses a #<temp> table the table is ...

  • Allocated by the DB "thread" (SPID) identifier
  • Only exists for that thread
  • Is automatically deleted when the thread completes (disconnect).

HTH

Regards ... Chris

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 2 February 2023 21:07 PM UTC
  2. PowerBuilder
  3. # 4

Hi,

I haven't used sql server for some time, so I'm not so sure if your temp table can be seen or not by other users.

What I do know, is that MS has this great (free) tool MS sql server Management Studio https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver16 

Why on earth would you use the crappy DB painter of the PB IDE?

regards.

MiguelL

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.