Facebook
From Andrew, 2 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 234
  1. 4.SESSION_USER
  2.  
  3. 5.CREATE TRIGGER trgAfterInsert ON[DR].[dbo].[Sales]
  4. FOR INSERT
  5. AS  
  6.    insert into [Main].[dbo].[Sales_Audit]
  7. (Customer, OrderNumber, OrderQty,Product)
  8. SELECT Customer,OrderNumber, OrderQty,Product
  9. FROM inserted;
  10.  
  11. 6.You need to use Data Query Language (DQL).
  12. 7.The other Views that reference that name will use the table.
  13. 8.CEILING
  14. 9.WITH   cteTotalSales (SalesPersonID, SalesTotal)
  15.   AS
  16.   (   SELECT SalesPersonID, SUM(SubTotal) as SalesTotal
  17.     FROM Sales.SalesOrderHeader
  18.     WHERE SalesPersonID IS NOT NULL
  19.     GROUP BY SalesPersonID  )
  20.  
  21.  
  22. 10.When you are working with hierarchical data
  23. 11.You will receive an error: The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
  24. 12.ELECT EmployeeName, Department
  25. FROM Employee
  26. FULL OUTER JOIN Department
  27. ON Employee.DepartmentID=Department.DepartmentID
  28. ORDER BY EmployeeName
  29.  
  30. 13.AVG(DISTINCT UnitPrice)
  31. 14.BEGIN TRANSACTION
  32. ... statements here ...
  33. COMMIT TRANSACTION
  34.  
  35. 15.SAVEPOINT
  36. 16.Select  Customerid,  Sum(SalesTotal)
  37. from Customers
  38. Group by CustomerId
  39. Having Sum(SalesTotal) > 5000
  40. 17.COALESCE(@DepartmentName,'')
  41. 18.SELECT SUBSTRING(CityPrice, (POSITION('_' IN CityPrice ) +1) ,5)
  42. 19.Use Dense_Rank in place of Rank
  43. 20.They do not store data and are searchable.
  44. 21.Select Name, CreateDate, AccountId
  45. From Account1 Where State = 'IN'
  46. Union
  47. Select Name, CreateDate
  48. From Account2 Where State = 'IN'
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.