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

推荐订阅源

T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Palo Alto Networks Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Schneier on Security
Engineering at Meta
Engineering at Meta
I
InfoQ
L
LangChain Blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
WordPress大学
WordPress大学
P
Privacy & Cybersecurity Law Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Last Watchdog
The Last Watchdog
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
S
SegmentFault 最新的问题
爱范儿
爱范儿
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
AI
AI
T
Tor Project blog
I
Intezer
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
N
News and Events Feed by Topic
Latest news
Latest news
S
Security Affairs
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
S
Securelist

博客园 - Meyer

NPOI中嵌入图片 SQL Server不能通过条件控制生成同名的存储过程 我的2004 String TechEd流水帐 行医要厚道 Tech ed 2004 sh Asp.net程序的身份 delphi与asp.net - Meyer - 博客园 被C#2005 Express 撞了一下腰 闲话一 ActiveX CRView 与Asp.net 在水晶报表中显示条形码 Crystal Report&Barcode Crystal Report 新工作 这是.Text 的trackback功能吗? about zhanbos' quiz GMail I Get
SQL中一个不明的错误
Meyer · 2004-12-09 · via 博客园 - Meyer

ERROR>>未能找到 ID 为 104 的数据库。可能该数据库尚未激活,也可能正在转换过程中。
这个错误我是认为比较诡异了。请高手解释一下

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fn]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[fn]
GO
CREATE FUNCTION  fn
(
    @type     varchar(32)
)
RETURNS varchar(32)
AS
Begin
    declare @Status_for  varchar(32)
    set @Status_for=case @type
                    when 'd'  then  'd'
                    when 'c'  then  'c'                   
                    else  'UnKnow'
                  end
    return @Status_for   
End
GO


create table #t
(
  col1     varchar(32),
  col2     varchar(32),
  col3     int
)
insert into #t(col1, col2, col3) values('#t1', 'd', 1)
insert into #t(col1, col2, col3) values('#t2', 'd', 2)
insert into #t(col1, col2, col3) values('#t3', 'c', 1)
insert into #t(col1, col2, col3) values('#t4', 'c', 2)

create table #b
(
  b1     int,
  b2     varchar(32),
  b3     varchar(32)
)
insert into #b(b1, b2, b3) values(1, 'd', 'd1')
insert into #b(b1, b2, b3) values(2, 'd', 'd2')
insert into #b(b1, b2, b3) values(1, 'c', 'c1')
insert into #b(b1, b2, b3) values(2, 'c', 'c2')

--下面的查询没有问题
select *
from       #t a
left join  #b b on b.b1 = a.col3 and b.b2 = dbo.fn(a.col2)

--这个子查询,错误就比较诡异了
select * from
(
select *
from       #t a
left join  #b b on b.b1 = a.col3 and b.b2 = dbo.fn(a.col2)
) a


--clear the garbage
drop table #t
drop table #b
drop function dbo.fn