惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
罗磊的独立博客
月光博客
月光博客
GbyAI
GbyAI
腾讯CDC
G
Google Developers Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
雷峰网
雷峰网
B
Blog RSS Feed
美团技术团队
M
MIT News - Artificial intelligence
有赞技术团队
有赞技术团队
D
Docker

博客园 - RainWaterLily

[转贴]如何在3个月内拥有3年的工作经验 [转帖]四种不正确的职业心态 (转载)HP大中华区总裁孙振耀畅谈工作与生活 什么是脑图?(转贴) 创建SQL Server数据库时,首先判断数据库文件是否存在 SQL语句获取数据库文件全路径 MS SQL Server 2005 无法远程连接 windows计划任务 见“利”忘“义”??? [转]post和get的不同之处 [转]C# 向web网站GET、POST 数据 [转]C# GET、POST方式请求web SQL2005常见性能问题排错演示代码[收藏] sp_fulltext_service (Transact-SQL) 设计模式的原则(转) Extending SQL 2005 Fulltext Search (转载) 感悟(转载) [美]杰克·韦尔奇《赢》摘记 转载:动态调用WebService(C#)
获取当前正在使用的SQL 数据库
RainWaterLily · 2008-10-06 · via 博客园 - RainWaterLily

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[temp_GetDatabaseName]') AND type in (N'U'))
    drop table temp_GetDatabaseName
create Table temp_GetDatabaseName (
spid int,
ecid int,
status nvarchar(100),
loginame nvarchar(100),
hostName nvarchar(255),
blk int,
dbname nvarchar(255),
cmd nvarchar(1000),
request_id int --此字段在SQL 2000 中不存在,只存在于SQL2005
)
declare @dataBaseName nvarchar(128)
insert into temp_GetDatabaseName exec sp_who @@spid
select @dataBasename = dbName from temp_GetDatabaseName
print @dataBasename

posted on 2008-10-06 17:39  RainWaterLily  阅读(856)  评论()    收藏  举报