Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Tigerite
Starting Member
30 Posts |
Posted - 2004-03-09 : 10:05:19
|
| To explain what I mean, when you do, for instance:declare @tempTable table (xyz int, abc varchar(100))- this creates a table in tempdb usually with a generic name, such as #5FB205FE. Is there any way of finding this during execution time of the stored procedure? |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-03-09 : 10:35:32
|
| No kidding....DECLARE @x TABLE (Col1 int)SELECT * FROM SYSObjects where name like '#%'Damn, 2 new things in 1 day....and it's only10:30I guess you could SELECT MAX Create right after the declare...but why?Brett8-) |
 |
|
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-03-09 : 10:38:32
|
| Like Brett, I'd have to ask why?I'd come up with this, similar to Brett's but assuming you may have more than one table variable try to narrow it down to a column name you know would be unique in your table variables:SELECT o.nameFROM tempdb..syscolumns cLEFT JOIN tempdb..sysobjects o ON o.id = c.idWHERE o.name LIKE '#%'AND c.name = 'xyz'Raymond |
 |
|
|
Tigerite
Starting Member
30 Posts |
Posted - 2004-03-10 : 07:37:45
|
| I thought of those but they might not be transaction-safe, so I wasn't sure. I was trying to figure out how much memory the stored procedure was using up with temporary tables, which you can't find out from the table variables, and getting nowhere fast.. |
 |
|
|
|
|
|