Advertisement
PtiTom

CESI - Insertion Salesman

Apr 30th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.98 KB | None | 0 0
  1. DECLARE @nNewEntityId int
  2.  
  3. INSERT INTO Person.BusinessEntity
  4.            (rowguid
  5.            ,ModifiedDate)
  6.      VALUES
  7.            (NEWID()
  8.            ,GETDATE())
  9.  
  10. SELECT @nNewEntityId = @@identity
  11.  
  12.  
  13. INSERT INTO Person.Person
  14.            (BusinessEntityID
  15.            ,PersonType
  16.            ,NameStyle
  17.            ,Title
  18.            ,FirstName
  19.            ,MiddleName
  20.            ,LastName
  21.            ,Suffix
  22.            ,EmailPromotion
  23.            ,AdditionalContactInfo
  24.            ,Demographics
  25.            ,rowguid
  26.            ,ModifiedDate)
  27.      VALUES
  28.            (@nNewEntityId
  29.            ,'SC'
  30.            ,0
  31.            ,N''
  32.            ,'Tom'
  33.            ,'M'
  34.            ,'JEDUSOR'
  35.            ,'Lord'
  36.            ,0
  37.            ,NULL
  38.            ,NULL
  39.            ,NEWID()
  40.            ,GETDATE())
  41.  
  42. INSERT INTO HumanResources.Employee
  43.            (BusinessEntityID
  44.            ,NationalIDNumber
  45.            ,LoginID
  46.            ,OrganizationNode
  47.            ,JobTitle
  48.            ,BirthDate
  49.            ,MaritalStatus
  50.            ,Gender
  51.            ,HireDate
  52.            ,SalariedFlag
  53.            ,VacationHours
  54.            ,SickLeaveHours
  55.            ,CurrentFlag
  56.            ,rowguid
  57.            ,ModifiedDate)
  58.      VALUES
  59.            (@nNewEntityId
  60.            ,'012345678901234'
  61.            ,'iamlordvoldemort@contoso.com'
  62.            ,NULL
  63.            ,'Unnamed'
  64.            ,'1998-06-30'
  65.            ,'M'
  66.            ,'M'
  67.            ,'2019-04-12'
  68.            ,1
  69.            ,2
  70.            ,1
  71.            ,1
  72.            ,NEWID()
  73.            ,GETDATE())
  74.  
  75. INSERT INTO Sales.SalesPerson
  76.            (BusinessEntityID
  77.            ,TerritoryID
  78.            ,SalesQuota
  79.            ,Bonus
  80.            ,CommissionPct
  81.            ,SalesYTD
  82.            ,SalesLastYear
  83.            ,rowguid
  84.            ,ModifiedDate)
  85.      VALUES
  86.            (@nNewEntityId
  87.            ,NULL
  88.            ,15000
  89.            ,12
  90.            ,10
  91.            ,0
  92.            ,0
  93.            ,NEWID()
  94.            ,GETDATE())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement