This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Declare @x xml | |
| = | |
| ' | |
| <orders> | |
| <c> | |
| <FirstName>Christy</FirstName> | |
| <LastName>Zhu</LastName> | |
| <o> | |
| <SalesOrderID>43701</SalesOrderID> | |
| <OrderDate>2011-12-06T00:00:00</OrderDate> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Declare @x xml | |
| =' | |
| <orders> | |
| <c> | |
| <FirstName>Christy</FirstName> | |
| <LastName>Zhu</LastName> | |
| <o> | |
| <SalesOrderID>43701</SalesOrderID> | |
| <OrderDate>2011-12-06T00:00:00</OrderDate> | |
| <d> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Declare @x xml | |
| = | |
| ' | |
| <orders> | |
| <c FirstName="Christy" LastName="Zhu"> | |
| <o SalesOrderID="43701" OrderDate="2011-12-06T00:00:00"> | |
| <d ProductID="871" OrderQty="1" /> | |
| </o> | |
| </c> | |
| <c FirstName="Seth" LastName="Phillips"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALTER PROCEDURE [dbo].[GetDistance] | |
| @TownFrom varchar(50), | |
| @TownTo varchar(50), | |
| @unit varchar(5) | |
| as | |
| declare @or geography, @dest geography | |
| SET @or = (select coordinates from [dbo].[TownsOfireland] where Town=@TownFrom) | |
| SET @dest = (select coordinates from [dbo].[TownsofIreland] where Town=@TownTo) | |
| --IF @unit='miles' | |
| SELECT @or.STDistance(@dest)/1609.344 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALTER proc [campus\S00175680].[squareCreated] | |
| as | |
| declare @space geometry; | |
| set @space = geometry :: STGeomFromText( | |
| 'POLYGON ((10 10,10 20,20 20,20 10, 10 10))',0); | |
| set @space = geometry :: STGeomFromText( | |
| 'POLYGON ((20 20,20 40,40 40,40 20, 20 20))',0); | |
| SELECT @space ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO TownsOfireland | |
| VALUES | |
| ( | |
| -- Latitude Longtitde | |
| 'Sligo', geography::STGeomFromText('POINT(54.27661 -8.476089)',4326) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Alter Table Drones | |
| add Constraint Status | |
| check (Status ='Active' OR Status= 'Retired'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alter PROC dbo.Spat2 | |
| @LT varchar(50), @LG varchar(50), @NoOfConsignments int, @DroneID int | |
| AS | |
| DECLARE @RegionID int, @RegionG geography | |
| SET @RegionG = geography::STGeomFromText('POINT('+ @LT + ' ' + @LG +')', 4326); | |
| SELECT @regionID = RegionID FROM dbo.Regions WHERE Area.STIntersects(@RegionG) = 1 | |
| BEGIN TRY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create PROC Proc1XMLPath | |
| @ELoadID int, @X xml OUTPUT | |
| AS | |
| SELECT @X = ( | |
| SELECT LoadID "LoadID", DroneID "DroneID", | |
| (SELECT TrackingID "TrackingID", CustomerName "CustomerName", | |
| (SELECT Foods.FoodID "Detail/FoodID", Quantity "Detail/Quantity", Foods.FoodName "Detail/FoodItem/FoodName" | |
| FROM dbo.Consignments | |
| INNER JOIN dbo.ConsignmentsDetails ON |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alter FUNCTION dbo.fnc3ph | |
| ( | |
| -- Add the parameters for the function here | |
| @LoadID Int | |
| ) | |
| RETURNS | |
| @t TABLE | |
| ( | |
| -- Add the column definitions for the TABLE variable here | |
| PilotID char(15), PilotFname varchar(50), PLName varchar(50), Position varchar(15), TeamStatus varchar(20) |
NewerOlder