use Chap3


declare @space as FLOAT
set @space = dbo.CoilSpace(100.0, 0.50, 0.0038, 0.5)
print @space
 
select * from sys.assembly_modules

declare @rt int;
declare @st int;
set @st = 300
set @rt = 300
declare @pt int
declare @ptcnt int
while @rt < 4000
BEGIN
set @ptcnt = dbo.Planets(@st, @rt)
set @pt = dbo.PlanetTeeth(@st, @rt)
if(@pt > 8 and @ptcnt <> 0)
BEGIN
print @st
print @rt 
print @ptcnt
print @pt
print '---'
END
set @rt = @rt + 2
END

drop table Rings
drop table Suns
CREATE TABLE Rings
(
	Model varchar(10),
	Teeth int
)
CREATE TABLE Suns
(
  Model varchar(10),
  Teeth int
)

Insert into Rings values ('M1', 7224)
Insert into Rings values ('M2', 7826)
Insert into Rings values ('M3', 8429)
Insert into Suns values ('M5', 301)
Insert into Suns values ('M6', 602)
Insert into Suns values ('M7', 303)
Insert into Suns values ('M8', 304)

select * from rings


Select R.Model, S.Model from Rings as R JOIN Suns as S 
ON
dbo.Planets(S.Teeth, R.Teeth) <> 0
AND dbo.PlanetTeeth(S.Teeth, R.Teeth) <> 0

declare @st int
set @st = 100
declare @s char(900)
set @s = 'asfasfdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
print CONVERT(varchar, @st)
print CONVERT(char, @st)
print '--'
print Convert(char, @s,3)
print '--'
print cast(@s as char)
declare @m as money
set @m = 1000000000.09
print convert(char, @m, 0)

print convert(char, @m, 1)

print convert(char, @m, 2)

declare @d as float
set @d = 1000000000000000000000000000000000000
print Convert(char, @d, 0)
print Convert(char, @d, 1)
print Convert(char, @d, 2)
