Advertisement
MagnusArias

SBO | CLR SQL

Dec 14th, 2019
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.80 KB | None | 0 0
  1. DROP TYPE Punkt
  2. GO
  3. DROP ASSEMBLY [Punkt_a]
  4. GO
  5. CREATE ASSEMBLY [Punkt_a]
  6. AUTHORIZATION [dbo]
  7. FROM 'C:\e740\repos\Funkcje\CLR_Struct\CLR_Struct\bin\Debug\CLR_Struct.dll'
  8. WITH PERMISSION_SET = SAFE
  9. GO
  10. CREATE TYPE dbo.Punkt
  11. EXTERNAL NAME Punkt_a.Punkt;
  12.  
  13. DROP TABLE Punkty
  14. GO
  15. CREATE TABLE dbo. Punkty
  16. (ID INT IDENTITY(1,1) PRIMARY KEY, PunktyXY Punkt)
  17. GO
  18. INSERT INTO Punkty VALUES (CONVERT(Punkt, '3,4'));
  19. INSERT INTO Punkty VALUES (CONVERT(Punkt, '1,5'));
  20. INSERT INTO Punkty VALUES (CAST ('1,99' AS Punkt));
  21. GO
  22.  
  23. SELECT ID, PunktyXY FROM Punkty
  24. GO
  25. SELECT ID, PunktyXY.ToString() AS PunktyXY
  26. FROM Punkty;
  27. GO
  28. SELECT ID, CAST(PunktyXY AS VARCHAR)
  29. FROM Punkty;
  30. GO
  31. SELECT ID, CONVERT(VARCHAR, PunktyXY)
  32. FROM Punkty;
  33.  
  34. DECLARE @a Punkt;
  35. SET @a = CAST('1, 3' AS Punkt)
  36. SELECT @a, @a.ToString()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement