????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??????????????