declare @i int ,@j int  ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ' '
set @j = 1
while @j <=@i
begin
set @s += cast(@j as char(1)) + '*' + cast(@i as char(1))
set @s += ' '
set @j +=1
end
print @s
set @i += 1
end

  

declare @i int ,@j int  ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ''
set @j = 1
while @j <=9
begin
if @j >= @i
begin
set @s += cast(@i as char(1)) + '*' + cast(@j as char(1))
set @s += ' '
end
else
begin
set @s += ' '
end
set @j +=1
end
print @s
set @i += 1
end
declare @i int ,@j int  ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ''
set @j = 1
while @j <=@i
begin
if @j >= @i
begin
set @s += cast(@i as char(1)) + '*' + cast(@j as char(1))
set @s += ' '
end set @j +=1
end
print @s
set @i += 1
end
declare @i int ,@j int  ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ''
set @j = 1
while @j <=9
begin
if @j > 9 -@i
begin
set @s += cast(@i as char(1)) + '*' + cast((10 -@j) as char(1))
set @s += ' '
end
else
begin
set @s += ' '
end
set @j +=1
end
print @s
set @i += 1
end

SQL语句打印四个方向的9 9 乘法表的更多相关文章

  1. mybatis的Sql语句打印

    我们在使用mybatis的时候,有时候,希望可以在eclipse的控制台下打印出来sql语句,但是有时候却不希望相关的语句打印.这个时候,需要我们进行一些配置.  在mybatis中,他通过调用一些接 ...

  2. mysql基础复习(SQL语句的四个分类),

                                                                                                       ( ...

  3. 抓取锁的sql语句-第四次修改

    --完成情况   变量V_BLOCKING_SID 用来动态抓取 产生锁的会话id,输出参数没有任何问题,但是执行报错  标识符无效! CREATE OR REPLACE PROCEDURE SOLV ...

  4. Spring+MyBatis框架中sql语句的书写,数据集的传递以及多表关联查询

    在很多Java EE项目中,Spring+MyBatis框架经常被用到,项目搭建在这里不再赘述,现在要将的是如何在项目中书写,增删改查的语句,如何操作数据库,以及后台如何获取数据,如何进行关联查询,以 ...

  5. 如何优化用SQL语句INSERT INTO … SELECT插入数据时锁全表的问题

    1.binlog format 启用Row Based Replication(行复制)模式: SET GLOBAL binlog_format = 'ROW'; 如果你想永久的启用这个模式,请修改m ...

  6. 数据库常用SQL语句(一):常用的数据库、表操作及单表查询语句

    以MySql数据库为例进行说明 1.数据库操作语句 2.表的操作语句 3.表中的字段操作语句 4.MYSQL支持的完整性约束 数据库管理系统提供了一致机制来检查数据库表中的数据是否满足规定的条件,以保 ...

  7. SQL语句 打印等腰三角形,菱形

    ) BEGIN 5 SET @S='' 8 BEGIN -@I) 10 BEGIN SET @S=@S+' ' END ELSE 14 BEGIN SET @S=@S+'**' 16 END END ...

  8. SQL语句的四种连接

    SQL的四种连接查询 内连接 inner join 或者 join 外连接 左连接   left join 或者 left outer join 右连接  right join 或者 right ou ...

  9. SQL语句(四)联表查询

    目录 一.关联查询的分类 按年代分 按功能分 二.sql92语法的连接 语法 1. 简单应用 2. 为表起别名 3. 加入筛选 4. 加入分组 5. 三表连接 6. 非等值连接 7. 自连接 三.sq ...

随机推荐

  1. bzoj 3130 [Sdoi2013]费用流(二分,最大流)

    Description Alice和Bob在图论课程上学习了最大流和最小费用最大流的相关知识.    最大流问题:给定一张有向图表示运输网络,一个源点S和一个汇点T,每条边都有最大流量.一个合法的网络 ...

  2. 【暑假】[深入动态规划]UVa 10618 The Bookcase

    UVa 12099  The Bookcase 题目: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=42067 思路:    ...

  3. 【openstack报错】【metadata问题】‘http://169.254.169.254/2009-04-04/meta-data/instance-id’ failed : url error [[Errno 111] Connection refused]

    [时间]2014年2月25日 [平台]ubuntu 12.04.3 openstack havana  with nova-network in multi-host [日志]实例启动时输出的日志内容 ...

  4. ubuntu下一次网络流量危机

    为了便于团队合作,公司局域网搭建了一台服务器,安装了ubuntu 13.04. 一直相安无事.直到今天上午. 突然的大流量,让整个局域网网速慢下来,网页都打不开. 差不多一个小时都是这样,我还以为是公 ...

  5. openstack fe

  6. [iOS基础控件 - 4.3] APP列表 xib的使用

    A.storyboard和xib 1.storyboard: 相对xib较重量级,控制整个应用的所有界面 2.xib: 轻量级,一般用来描述局部界面   B.使用 1.新建xib文件 New File ...

  7. 转载Entity Framework 5.0(EF first)中的添加,删除,修改,查询,状态跟踪操作

    转载原出处:http://www.cnblogs.com/kenshincui/p/3345586.html Entity Framework将概念模型中定义的实体和关系映射到数据源,利用实体框架可以 ...

  8. php中带mb的字符串处理函数

    int strlen ( string $string ) int mb_strlen ( string $str [, string $encoding ] ) encoding参数为字符编码.如果 ...

  9. Java循环语句 for

    语法: 特点:相比 while 和 do...while 语句结构更加简洁易读 例如,输出 1000 遍"我爱慕课网",使用 for 的实现代码为: 需要留心的几个小细节: 1. ...

  10. 8000401a 错误及解决办法

    将web程序部署到服务器上时,偶尔会遇到下面的错误: System.Runtime.InteropServices.COMException (0x8000401A): 检索 COM 类工厂中 CLS ...