select * from fnGetStudentByTeacher('804')
select dbo.fnGetSumScore('3-245')
-------------------------------------------- ------------------±í?μoˉêy
set ansi_nulls on
go
set quoted_identifier on
go
------------------------------------
---Author£o??
---CreateDate£o2009-11-12
---Decription: í¨1yà?ê|??è??§éúD??¢
------------------------------------
create function fnGetStudentByTeacher
(
@TNO varchar(3) --à?ê|μ?ID?μ
)
returns table
as
return
(
select a.*
from student a,course c,score d
where c.cno = d.cno and a.sno = d.sno
and c.tno = @TNO
)
select * from fnGetStudentByTeacher('804')
--------------------------------------------- ----±êá??μoˉêy
create function fnGetSumStudentScore
(
@strCNO varchar(5) ---
)
returns float
as
begin
declare @fltSumScore float
select @fltSumScore = sum(degree) from score where cno = @strCNO
return @fltSumScore
end
go
select dbo.fnGetSumStudentScore('3-105')
----------
select quotename('abcd')
declare @i int
while @i > 0
begin
select charindex(',','de,fa,b')
set @i=@i+1
end
select substring('abcde',1,3)
select charindex(',','a,b,cd')
sql标量值函数表值函数



