在#tables 中使用 Object_id() 函数 [英] using Object_id() function with #tables

查看:26
本文介绍了在#tables 中使用 Object_id() 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确定我的数据库中是否存在临时表.

I want to ensure if a temporary table exists in my database or not.

我尝试使用 OBJECT_ID() 函数,但似乎无法将它与临时表一起使用.

I tried to use OBJECT_ID() function but it seems that I can't use it with temporary tables.

我该如何解决这个问题?

How can I resolve this problem?

推荐答案

使用

OBJECT_ID('tempdb..#foo')

在另一个数据库的上下文中运行时获取临时表的 id.

to get the id for a temporary table when running in the context of another database.

这篇关于在#tables 中使用 Object_id() 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆