问题:2.Author ( Ano, Name, Age, Sex ) Book ( Bno , Title , Publisher )Write ( Ano , Bno , IsFirstAuthor ),(2)给定书名,如果此书的作者只有一人,则输出此作者名字,否则返回 NULL(函数)代码如下:Create function pangduan(@Title char(10)) returns char AsBegindeclare @anum int,@Ano char(10),@Name char(10)select @anum=count(*) from write,book where write.Bno=book.Bno and Title=@Titleif @anum=1beginselect @Ano=Ano from write,book where write.Bno=book.Bno and Title=@Titleselect @Name=Name from author where Ano=@Anoendelsebeginset @Name=nullendreturn @Name调用函数的时候,应该返回作者名字的时候,返回了十个空格,应该返回null的时候,返回了一个空格,end
- 1 回答
- 0 关注
- 159 浏览
添加回答
举报
0/150
提交
取消