SQL?????????ЩBUG
???????????? ???????[ 2011/11/21 10:18:25 ] ????????
????SQL????????????????????????????????????????????????????????????????????????????????????bug????β????????????????????????????
Sql Server ?????????в?????????????????????????????????д???????????????
1??????и???sysdenpends?????????????SQL???????????????????????????ν??????????????ɡ?
???磺?????view??????????function???
???????д??????????????γ????μ??????????fnT1 <-- vwT1 <-- fnT2
???view vwT1???????????м?
Create function fnT1()
Returns Integer
As
begin
Return 123
end
go
Create view vwT1
As
Select aa=dbo.fnT1()
Go
Create function fnT2()
Returns Table
As
Return (Select * From vwT1)
Go
???е???????????Enterprise????SQL???????????????????????????????????????????
if exists (select * from dbo.sysobjects where id = object_id(N[dbo].[fnT1]) and xtype in (NFN?? NIF?? NTF))
drop function [dbo].[fnT1]
GO
if exists (select * from dbo.sysobjects where id = object_id(N[dbo].[fnT2]) and xtype in (NFN?? NIF?? NTF))
drop function [dbo].[fnT2]
GO
if exists (select * from dbo.sysobjects where id = object_id(N[dbo].[vwT1]) and OBJECTPROPERTY(id?? NIsView) = 1)
drop view [dbo].[vwT1]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create view vwT1
As
Select aa=dbo.fnT1()
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create function fnT1()
Returns Integer
As
begin
Return 123
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create function fnT2()
Returns Table
As
Return (Select * From vwT1)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
????????????????????????view??????function???????????????????????????
??????????????????μ???????????????????????????ò??????
??????: ??? 208?????? 16???? 1?????? vwT1???? 4
?????? dbo.fnT1 ??Ч??
??????: ??? 208?????? 16???? 1?????? fnT2???? 5
?????? vwT1 ??Ч??
2??????????
??????????bug??????????????????????--????????????????????в???????????????????????bug??
?????????????
3?????????SP??????
??????????????????spGetIDStr??spAnalyseStrList??????????????????????????spGetIDStr?????е????κε???
???????????Sql Server??????????????????棨??????????????????
spGetIDStr??????????????sysdepends??????????????洢????spAnalyseStrList?????????
???????????????????????????????????????????д???????????????
???????????????bug?????????????????
????????sp??ж??????????????????????????????sp?????sp???????????????????????????
?γ??????????spB1 <--- spA1
Create Proc spB1
As
Return 11
Go
Create proc spA1
As
Begin
Declare @i int
Exec @i=spB1
Return @i*2
End
Go
??????????
if exists (select * from dbo.sysobjects where id = object_id(N[dbo].[spA1]) and OBJECTPROPERTY(id?? NIsProcedure) = 1)
drop procedure [dbo].[spA1]
GO
if exists (select * from dbo.sysobjects where id = object_id(N[dbo].[spB1]) and OBJECTPROPERTY(id?? NIsProcedure) = 1)
drop procedure [dbo].[spB1]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create proc spA1
As
Begin
Declare @i int
Exec @i=spB1
Return @i*2
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create Proc spB1
As
Return 11
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
???????????????????????spA1??spB1???????????????????????????A???????B??棬???????????????????
?????????????????????????????????????spA1??????spB1????棬????????????????????????????sysdepends????д??
??????bug????????????SP???????????????
??λ?????????????????????sp??fn??sp Group??????????????
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11