Tuesday, February 14, 2012

Can I Query A Temporary Table?

Hi,
I have a job that has been running for years. All of sudden I see
that it's hanging, but not outright failing. I can pinpoint a
specific SP that runs and about how far it gets. It creates a
temporary table which then gets data selected into it and then does
work based on that. I can see that the temp table is created and I've
run the select into query myself and there don't seem to be any
issues. The one thing I can't tell is if there is any data in that
temp table. Is there anyway to query the table or even get
information about how many rows are in it?
Thanks,
BillIs it a global temporary table? If it's a global one, you can simply query
it using SELECT with another session.
If it's a local temporary table, then only one session can reach it, the one
which created it.
However, this temp table will be droped automatically when its owner's
session is closed whether it's glocal or local.
You can find more information about temp tables from the following link:
http://msdn2.microsoft.com/en-us/library/ms174979.aspx
--
Ekrem Önsoy
http://www.ekremonsoy.net , http://ekremonsoy.blogspot.com
MCBDA, MCITP:DBA, MCSD.Net, MCSE, MCBMSP, MCT
"zinck74" <bkelly3@.gmail.com> wrote in message
news:1193936161.327854.167670@.k35g2000prh.googlegroups.com...
> Hi,
> I have a job that has been running for years. All of sudden I see
> that it's hanging, but not outright failing. I can pinpoint a
> specific SP that runs and about how far it gets. It creates a
> temporary table which then gets data selected into it and then does
> work based on that. I can see that the temp table is created and I've
> run the select into query myself and there don't seem to be any
> issues. The one thing I can't tell is if there is any data in that
> temp table. Is there anyway to query the table or even get
> information about how many rows are in it?
> Thanks,
> Bill
>|||Yeah, unfortunately it's local table. I can see it in the list of
temporary tables in tempdb, but I can't get any stats on it. It seems
like there should be some way to get the stats somehow. Anyone else?
If anything I'd just like to be able to see the number of rows
Thanks,
Bill
On Nov 1, 11:16 am, Ekrem =D6nsoy <ek...@.btegitim.com> wrote:
> Is it a global temporary table? If it's a global one, you can simply query
> it using SELECT with another session.
> If it's a local temporary table, then only one session can reach it, the =one
> which created it.
> However, this temp table will be droped automatically when its owner's
> session is closed whether it's glocal or local.
> You can find more information about temp tables from the following link:h=ttp://msdn2.microsoft.com/en-us/library/ms174979.aspx
> --
> Ekrem =D6nsoyhttp://www.ekremonsoy.net,http://ekremonsoy.blogspot.com
> MCBDA, MCITP:DBA, MCSD.Net, MCSE, MCBMSP, MCT
> "zinck74" <bkel...@.gmail.com> wrote in message
> news:1193936161.327854.167670@.k35g2000prh.googlegroups.com...
>
> > Hi,
> > I have a job that has been running for years. All of sudden I see
> > that it's hanging, but not outright failing. I can pinpoint a
> > specific SP that runs and about how far it gets. It creates a
> > temporary table which then gets data selected into it and then does
> > work based on that. I can see that the temp table is created and I've
> > run the select into query myself and there don't seem to be any
> > issues. The one thing I can't tell is if there is any data in that
> > temp table. Is there anyway to query the table or even get
> > information about how many rows are in it?
> > Thanks,
> > Bill- Hide quoted text -
> - Show quoted text -

No comments:

Post a Comment