Skip to content
Tako Lee edited this page Feb 16, 2014 · 24 revisions
  • Fit into one line if possible

    INSERT INTO dbo.Points (PointValue) VALUES (CONVERT(Point, '3,4'));
  • Column list/value list fit into one line if possible

    • VALUES keyword left align with INSERT keyword

      INSERT INTO MyLinkServer.AdventureWorks2008R2.HumanResources.Department (Name, GroupName)
      VALUES (N'Public Relations', N'Executive General and Administration');
    • VALUES keyword right align with INTO keyword

      INSERT INTO MyLinkServer.AdventureWorks2008R2.HumanResources.Department (Name, GroupName)
           VALUES (N'Public Relations', N'Executive General and Administration');
  • Stacked column list

    • Comma at the end of line
       INSERT INTO Sales.SalesHistory WITH (TABLOCK)
           (SalesOrderID,                   
            SalesOrderDetailID,             
            CarrierTrackingNumber,                                
            ModifiedDate)                   
       SELECT * FROM Sales.SalesOrderDetail;

Clone this wiki locally