Skip to content

Instantly share code, notes, and snippets.

View lest-xu's full-sized avatar
🌴
On vacation

lest-xu

🌴
On vacation
  • United States
View GitHub Profile
@lest-xu
lest-xu / BubbleSort.sql
Created February 8, 2018 16:12 — forked from max-mulawa/BubbleSort.sql
Bubble Sort in T-SQL
IF OBJECT_ID('tempdb..#NumbersArray') IS NOT NULL
DROP TABLE #NumbersArray
GO
--Create T-SQL version of number array look-like
CREATE TABLE #NumbersArray
(
ArrayIndex Int PRIMARY KEY CLUSTERED,
Value Int
)
GO
USE MyDB
Go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('"Order"') and o.name = 'FK_ORDER_REFERENCE_CUSTOMER')
alter table "Order"
drop constraint FK_ORDER_REFERENCE_CUSTOMER
go
USE MyDB
GO
SET IDENTITY_INSERT Customer ON
INSERT INTO [Customer] ([Id],[FirstName],[LastName],[City],[Country],[Phone])VALUES(1,'Maria','Anders','Berlin','Germany','030-0074321')
INSERT INTO [Customer] ([Id],[FirstName],[LastName],[City],[Country],[Phone])VALUES(2,'Ana','Trujillo','México D.F.','Mexico','(5) 555-4729')
INSERT INTO [Customer] ([Id],[FirstName],[LastName],[City],[Country],[Phone])VALUES(3,'Antonio','Moreno','México D.F.','Mexico','(5) 555-3932')
INSERT INTO [Customer] ([Id],[FirstName],[LastName],[City],[Country],[Phone])VALUES(4,'Thomas','Hardy','London','UK','(171) 555-7788')
INSERT INTO [Customer] ([Id],[FirstName],[LastName],[City],[Country],[Phone])VALUES(5,'Christina','Berglund','Luleå','Sweden','0921-12 34 65')
INSERT INTO [Customer] ([Id],[FirstName],[LastName],[City],[Country],[Phone])VALUES(6,'Hanna','Moos','Mannheim','Germany','0621-08460')
USE MyDB
Go
CREATE PROCEDURE [dbo].[usp_GetSuppliers]
AS
BEGIN
--Declare Local Variables
USE [MyDB]
GO
CREATE PROCEDURE [dbo].[usp_GetOrders]
AS
BEGIN
--Declare Local Variables
USE [MyDB]
GO
CREATE PROCEDURE [dbo].[usp_GetOrderItems]
AS
BEGIN
--Declare Local Variables
USE [MyDB]
GO
CREATE PROCEDURE [dbo].[usp_GetCustomers]
AS
BEGIN
--Declare Local Variables
namespace Angular6Mvc5.Models
{
public class Supplier
{
public int Id { get; set; }
public string CompanyName { get; set; }
public string ContactName { get; set; }
public string ContactTitle { get; set; }
public string City { get; set; }
public string Country { get; set; }
namespace Angular6Mvc5.Models
{
public class Customer
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string City { get; set; }
public string Country { get; set; }
public string Phone { get; set; }
@lest-xu
lest-xu / Order.cs
Last active February 8, 2019 14:26
namespace Angular6Mvc5.Models
{
public class Order
{
public int Id { get; set; }
public DateTime OrderDate { get; set; }
public int OrderNumber { get; set; }
public int CustomerId { get; set; }
public double TotalAmount { get; set; }