2008-06-03 MS-SQL 99乘法實作 5083 0 摘要:MS-SQL 99乘法實作 因為找不到 for 的用法(或者是MS-SQL 語法終無此種語法) 所以使用 while 方式來實做DECLARE @i int, @j int, @sum varchar(500) set @i = 1 WHILE @i <= 9 begin set @j = 1 set @sum = '' while @j <= 9 begin set @sum = @sum + cast(@i as char(1)) + '*' + cast(@j as char(1)) + '=' + cast((@i * @j) as char(2)) + space(2) set @j = @j + 1 end print @sum set @i = @i + 1 end SQL 回首頁