有关sqlServer2000题目+代码.docVIP

  • 14
  • 0
  • 约2.79千字
  • 约 4页
  • 2018-02-08 发布于河南
  • 举报
有关sqlServer2000题目代码

T—SQL操作题 1.输出1到50之间所有不能被7和3整除的数。 If @a%3!=0 and @a%7!=0 2.输出3到100之间的素数。 declare @a int,@j int,@pd bit set @a=3 while @a=50 begin set @pd=1 --假定@a是素数 set @j=2 while @j@a begin if @a%@j=0 begin set @pd=0 break end else set @j=@j+1 end if @pd=1 print cast(@a as char(2))+是素数 set @a=@a+1 end 3.有一个序列,前两个数是1,第三个数是前两个数之和,以后每个数都是前两个数之和,输出次数列的第30个数。 declare @a int,@b int,@temp int,@count int select @a=1,@b=1,@count=3 while @count=30 begin set @temp=@a+@b set @a=@b set @b=@temp set @count=@count+1 end print @temp 4.编写自定义函数jc,实现求一

文档评论(0)

1亿VIP精品文档

相关文档