好文档 - 专业文书写作范文服务资料分享网站

sql标量值函数表值函数

天下 分享 时间: 加入收藏 我要投稿 点赞

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标量值函数表值函数

select*fromfnGetStudentByTeacher('804')selectdbo.fnGetSumScore('3-245')--------------------------------------------------------------±í?μoˉêysetansi_nulls
推荐度:
点击下载文档文档为doc格式
0gsuh8fotl6et871df8g8njyy26yjv018lp
领取福利

微信扫码领取福利

微信扫码分享