(1):Select Name From Master..SysDataBases Where DbId=(Select Dbid From Master..SysProcesses Where Spid = @@spid)
(2):--NoteMessage 为数据库名称
if db_id('NoteMessage')=(Select Dbid From Master..SysProcesses Where Spid = @@spid)
print 'OK'
(1):Select Name From Master..SysDataBases Where DbId=(Select Dbid From Master..SysProcesses Where Spid = @@spid)
(2):--NoteMessage 为数据库名称
if db_id('NoteMessage')=(Select Dbid From Master..SysProcesses Where Spid = @@spid)
print 'OK'