DECLARE @d LDim
SELECT CAST(@d.GetScaled(2) as VARCHAR(MAX))
SELECT @d.GetScaled(2)





DECLARE @d LDim
SELECT @d.GetScaledCNR(1.2)
SET @d = '1 ft'
SELECT @d
select @d.SomeMethod2()
SELECT @d.GetScaledCNR(1.2)

Print 'got here'
--SET @d.ScaleBy(1.1)
SELECT @d.TestPropInt

DECLARE @d LDim
SELECT CAST(@d AS LDim)


DECLARE @d LDim
SET @d = NULL
SELECT @d.ToString()
SELECT @d.IsNull




DECLARE @d LDim
Select @d.IsNull

--SET @d = '1 ft'
SELECT CAST(@d.GetScaled(1.2) AS VARCHAR(MAX))



DECLARE @s SomeUDT
SELECT @s.Method1()


DECLARE @s SomeUDT
DECLARE @n INT
SELECT @n

DECLARE @s1 SomeUDT
SET @s1 = @s.Method2()
SELECT @s1

SELECT @s.Method2()


declare @d LDim
SET @d.ScaleBy(3)


DECLARE @i INT
DECLARE @dim LDim 
SELECT @i
--SELECT @dim


DECLARE @i INT
DECLARE @dim LDim 
IF @i IS NULL print '@i is null'
IF @dim IS NULL print 'IS NULL @dim is null'
IF @dim.IsNull=1  print 'IsNull @dim is null'
SELECT @dim.IsNull

DECLARE @d1 LDim
DECLARE @d2 LDim
SET @d1 = '1 ft'
SET @d2 = '1 in'
SET @d1 = LDim::op_Addition(@d1, @d2)
SET @d1 = LDim::LDimAdd(@d1, @d2)
SELECT CAST(@d1 AS VARCHAR(MAX))

DECLARE @d LDim
SET @d = CAST(0xCD59000002 as LDim)


DECLARE @d Ldim
SET @d = '2 ft'
SELECT @d.PTest()



DECLARE @d Ldim
SET @d = '2 ft'
DECLARE @x xml
SET @x = CAST(@d AS xml)
SELECT @x 
SET @d = CAST(@x as LDim)
SELECT CAST(@d as VARCHAR(MAX))

TRUNCATE TABLE Lengths

--DROP TABLE Lengths

CREATE TABLE Lengths
(
ID int IDENTITY PRIMARY KEY,
Value LDim
)

INSERT INTO Lengths VALUES ('1 ft')
INSERT INTO Lengths VALUES ('1.54 ft')
INSERT INTO Lengths VALUES ('2.3 in')

SELECT ID, CAST(Value as XML) as Value FROM Lengths FOR XML AUTO

SELECT SUM(ID) from Lengths where ID > 10000
select * from sys.dm_os_hosts


Select CAST(dbo.SumLDim(value) AS VARCHAR(MAX)) from Lengths



SELECT ID, Value FROM Lengths FOR XML AUTO


ALTER DATABASE Scratch set TRUSTWORTHY ON
ALTER DATABASE Scratch set TRUSTWORTHY OFF

select dbo.LAsmTest()

--drop table dims

create table dims
(
value LDim
)

insert into dims values ('1 ft')
insert into dims values ('2 ft')


select cast(value as xml) from dims for xml auto, xmlschema


select value from dims for xml raw


DECLARE @t TrivialUDT
SET @t = '1'
SELECT CAST(@t as xml)

SELECT CONVERT(xml, @t).query('/*')

DROP TYPE LDim

DECLARE @x xml
SET @x ='<LDim>
  <Dimension xmlns="urn:Dimension:linear"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true">
  </Dimension>
</LDim>';
DECLARE @d LDim
SET @d = CAST(@x as LDim)
IF @d IS NULL PRINT '@d is null'



<LDim>
  <Dimension>
    <value>2</value>
    <units>ft</units>
  </Dimension>
</LDim>

DECLARE @d Ldim
SET @d = LDim::Parse(NULL)
DECLARE @x xml
SET @x = CAST(CAST(NULL AS LDim) AS xml)
SELECT @x 
SET @d = CAST(@x as LDim)
SELECT CAST(@d as VARCHAR(MAX))

SELECT LDim::Fieldtest
SELECT LDim::Setback

SELECT CAST(LDim::Parse(NULL) AS VARCHAR(MAX))


create assembly [DimensionXmlSupport]
FROM
'C:\Dan Docs\NewSql2005Book\(05)UDT\samples\Dimension\bin\Debug\Dimension.XmlSerializers.dll'
--DROP Assembly [DimensionXmlSupport]
select * from sys.assemblies
select * from sys.assembly_references

-- drop assembly[TrivialUDT.XmlSerializers]
create assembly [TrivialUDT.XmlSerializers]
FROM
'C:\Dan Docs\NewSql2005Book\(05)UDT\samples\TrivialUDT\bin\debug\TrivialUDT.XMLSerializers.dll'

select * from sys.assembly_files
select * from sys.assemblies

DROP TYPE LDim
dimension.xmlserializers, version=0.0.0.0, culture=neutral, publickeytoken=null, processorarchitecture=msil
dimension.xmlserializers
