mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Merge branch 'dev' of github.com:Microsoft/sqltoolsservice into dev
This commit is contained in:
@@ -113,18 +113,9 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.BatchParser
|
||||
}
|
||||
}
|
||||
|
||||
static void CopyToOutput(string sourceDirectory, string filename)
|
||||
{
|
||||
File.Copy(Path.Combine(sourceDirectory, filename), filename, true);
|
||||
FileUtilities.SetFileReadWrite(filename);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BatchParserTest()
|
||||
{
|
||||
CopyToOutput(FilesLocation, "TS-err-cycle1.txt");
|
||||
CopyToOutput(FilesLocation, "cycle2.txt");
|
||||
|
||||
Start("err-blockComment");
|
||||
Start("err-blockComment2");
|
||||
Start("err-varDefinition");
|
||||
|
||||
@@ -135,5 +135,27 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
SignatureHelp signatureHelp = service.GetSignatureHelp(textDocument, result.ScriptFile);
|
||||
Assert.NotNull(signatureHelp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test overwriting the binding queue context
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void OverwriteBindingContext()
|
||||
{
|
||||
var result = TestObjects.InitLiveConnectionInfo();
|
||||
|
||||
// add a new connection context
|
||||
var connectionKey = LanguageService.Instance.BindingQueue.AddConnectionContext(result.ConnectionInfo, overwrite: true);
|
||||
Assert.True(LanguageService.Instance.BindingQueue.BindingContextMap.ContainsKey(connectionKey));
|
||||
|
||||
// cache the server connection
|
||||
var orgServerConnection = LanguageService.Instance.BindingQueue.BindingContextMap[connectionKey].ServerConnection;
|
||||
Assert.NotNull(orgServerConnection);
|
||||
|
||||
// add a new connection context
|
||||
connectionKey = LanguageService.Instance.BindingQueue.AddConnectionContext(result.ConnectionInfo, overwrite: true);
|
||||
Assert.True(LanguageService.Instance.BindingQueue.BindingContextMap.ContainsKey(connectionKey));
|
||||
Assert.False(object.ReferenceEquals(LanguageService.Instance.BindingQueue.BindingContextMap[connectionKey].ServerConnection, orgServerConnection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
{
|
||||
internal class ComparisonFailureException : InvalidOperationException
|
||||
{
|
||||
internal string FullMessageWithDiff { get; private set; }
|
||||
internal string EditAndCopyMessage { get; private set; }
|
||||
|
||||
internal ComparisonFailureException(string fullMessageWithDiff, string editAndCopyMessage)
|
||||
: base(fullMessageWithDiff)
|
||||
{
|
||||
FullMessageWithDiff = fullMessageWithDiff;
|
||||
EditAndCopyMessage = editAndCopyMessage;
|
||||
}
|
||||
|
||||
internal ComparisonFailureException(string editAndCopyMessage)
|
||||
: base(editAndCopyMessage)
|
||||
{
|
||||
EditAndCopyMessage = FullMessageWithDiff = editAndCopyMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
@@ -5,10 +6,15 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains environment information needed when running tests.
|
||||
/// </summary>
|
||||
public class RunEnvironmentInfo
|
||||
{
|
||||
private static string cachedTestFolderPath;
|
||||
@@ -30,7 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
public static string GetTestDataLocation()
|
||||
{
|
||||
string testFolderPath;
|
||||
string testPath = @"test\Microsoft.SqlTools.ServiceLayer.Test.Common\TestData";
|
||||
string testPath = Path.Combine("test", "Microsoft.SqlTools.ServiceLayer.Test.Common", "TestData");
|
||||
string projectPath = Environment.GetEnvironmentVariable(Constants.ProjectPath);
|
||||
|
||||
if (projectPath != null)
|
||||
@@ -45,13 +51,23 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
}
|
||||
else
|
||||
{
|
||||
string defaultPath = Path.Combine(typeof(Scripts).GetTypeInfo().Assembly.Location, @"..\..\..\..\..");
|
||||
testFolderPath = Path.Combine(defaultPath, @"Microsoft.SqlTools.ServiceLayer.Test.Common\TestData");
|
||||
// We are running tests locally, which means we expect to be running inside the bin\debug\netcoreapp directory
|
||||
// Test Files should be found at the root of the project so go back the necessary number of directories for this
|
||||
// to be found. We are manually specifying the testFolderPath here for clarity on where to expect this
|
||||
|
||||
string assemblyDir = Path.GetDirectoryName(typeof(Scripts).GetTypeInfo().Assembly.Location);
|
||||
string defaultPath = Path.Combine(assemblyDir, GoUpNDirectories(4));
|
||||
testFolderPath = Path.Combine(defaultPath, "Microsoft.SqlTools.ServiceLayer.Test.Common", "TestData");
|
||||
|
||||
cachedTestFolderPath = testFolderPath;
|
||||
}
|
||||
}
|
||||
return testFolderPath;
|
||||
}
|
||||
|
||||
private static string GoUpNDirectories(int n)
|
||||
{
|
||||
string up = ".." + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "\\" : "/");
|
||||
return string.Concat(Enumerable.Repeat(up, n));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
return Enumerable.Empty<TestServerIdentity>();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return Enumerable.Empty<TestServerIdentity>();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
select *
|
||||
from mytable
|
||||
intersect
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
select *
|
||||
from mytable
|
||||
union
|
||||
select *
|
||||
from mytable
|
||||
union all
|
||||
select *
|
||||
from mytable
|
||||
except
|
||||
select *
|
||||
from mytable
|
||||
intersect
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
seLect *
|
||||
from mytable
|
||||
unIon
|
||||
selECT *
|
||||
fROM mytable
|
||||
union ALL
|
||||
select *
|
||||
from mytable
|
||||
excepT
|
||||
select *
|
||||
from mytable
|
||||
Intersect
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
SELECT *
|
||||
FROM mytable
|
||||
UNION
|
||||
SELECT *
|
||||
FROM mytable
|
||||
UNION ALL
|
||||
SELECT *
|
||||
FROM mytable
|
||||
EXCEPT
|
||||
SELECT *
|
||||
FROM mytable
|
||||
INTERSECT
|
||||
SELECT *
|
||||
FROM mytable
|
||||
@@ -0,0 +1,14 @@
|
||||
select *
|
||||
from mytable
|
||||
union
|
||||
select *
|
||||
from mytable
|
||||
except
|
||||
select *
|
||||
from mytable
|
||||
union all
|
||||
select *
|
||||
from mytable
|
||||
intersect
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1,19 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE (SalesPersonID, SalesOrderID, SalesYear)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT SalesPersonID, SalesOrderID, YEAR(OrderDate) AS SalesYear
|
||||
FROM Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT SalesPersonID, COUNT(SalesOrderID) AS TotalSales, SalesYear
|
||||
FROM Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE
|
||||
(
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
SalesYear
|
||||
)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
YEAR(OrderDate) AS SalesYear
|
||||
FROM
|
||||
Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
COUNT(SalesOrderID) AS TotalSales,
|
||||
SalesYear
|
||||
FROM
|
||||
Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE (SalesPersonID ,SalesOrderID ,SalesYear)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT SalesPersonID ,SalesOrderID ,YEAR(OrderDate) AS SalesYear
|
||||
FROM Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT SalesPersonID ,COUNT(SalesOrderID) AS TotalSales ,SalesYear
|
||||
FROM Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE
|
||||
(
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
SalesYear
|
||||
)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
YEAR(OrderDate) AS SalesYear
|
||||
FROM
|
||||
Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
COUNT(SalesOrderID) AS TotalSales,
|
||||
SalesYear
|
||||
FROM
|
||||
Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE
|
||||
(
|
||||
SalesPersonID
|
||||
,SalesOrderID
|
||||
,SalesYear
|
||||
)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT
|
||||
SalesPersonID
|
||||
,SalesOrderID
|
||||
,YEAR(OrderDate) AS SalesYear
|
||||
FROM
|
||||
Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT
|
||||
SalesPersonID
|
||||
,COUNT(SalesOrderID) AS TotalSales
|
||||
,SalesYear
|
||||
FROM
|
||||
Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
use AdventureWorks2008R2;
|
||||
go
|
||||
-- Define the CTE expression name and column list.
|
||||
with
|
||||
Sales_CTE
|
||||
(
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
SalesYear
|
||||
)
|
||||
as
|
||||
-- Define the CTE query.
|
||||
(
|
||||
select
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
YEAR(OrderDate) as SalesYear
|
||||
from
|
||||
Sales.SalesOrderHeader
|
||||
where SalesPersonID is not null
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
select
|
||||
SalesPersonID,
|
||||
COUNT(SalesOrderID) as TotalSales,
|
||||
SalesYear
|
||||
from
|
||||
Sales_CTE
|
||||
group by SalesYear, SalesPersonID
|
||||
order by SalesPersonID, SalesYear;
|
||||
go
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
with
|
||||
my_initial_table( column1, column2 )
|
||||
AS
|
||||
(
|
||||
select *
|
||||
from mytable
|
||||
),
|
||||
my_other_table( column1X, column2X )
|
||||
AS
|
||||
(
|
||||
select *
|
||||
from mytable2
|
||||
)
|
||||
select distinct top (10) PERCENT with ties
|
||||
alias1 = SIZE(mytable.mycol1), another = COUNT(new_elements), count(money) AS encore, id
|
||||
INTO my_new_table
|
||||
FROM my_initial_table
|
||||
@@ -0,0 +1,17 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE (SalesOrderID)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT SalesOrderID
|
||||
FROM Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT COUNT(SalesOrderID) AS TotalSales
|
||||
FROM Sales_CTE;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE
|
||||
(
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
SalesYear
|
||||
)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
YEAR(OrderDate) AS SalesYear
|
||||
FROM
|
||||
Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
COUNT(SalesOrderID) AS TotalSales,
|
||||
SalesYear
|
||||
FROM
|
||||
Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH
|
||||
Sales_CTE
|
||||
(
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
SalesYear
|
||||
)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
SalesOrderID,
|
||||
YEAR(OrderDate) AS SalesYear
|
||||
FROM
|
||||
Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT
|
||||
SalesPersonID,
|
||||
COUNT(SalesOrderID) AS TotalSales,
|
||||
SalesYear
|
||||
FROM
|
||||
Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
-- a numbered procedure containing
|
||||
-- which is an obsolete feature and will be removed
|
||||
/* in the future */
|
||||
create procedure p1;2
|
||||
/* this right here is a parameter */
|
||||
@p2 nvarchar(20)
|
||||
as
|
||||
-- useless comment
|
||||
select @p2
|
||||
@@ -0,0 +1,7 @@
|
||||
create procedure [Ugly.Schema].ProcWithUglySchema
|
||||
as
|
||||
/*this is comment 1*/
|
||||
begin
|
||||
/* this-is-comment-2! */
|
||||
select 1
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
-- my comment
|
||||
Create Procedure P1
|
||||
AS
|
||||
@@ -0,0 +1,10 @@
|
||||
create procedure [Ugly.Schema].ProcWithUglySchema
|
||||
as
|
||||
begin
|
||||
select 1
|
||||
end
|
||||
go
|
||||
CREATE PROCEDURE [dbo].[cursorVaryingColumn]
|
||||
@cursorCol CURSOR VARYING OUTPUT
|
||||
AS
|
||||
SELECT 'A'
|
||||
@@ -0,0 +1,6 @@
|
||||
Create Procedure dbo.P1
|
||||
@param1 int,
|
||||
@cursorCol CURSOR VARYING OUTPUT,
|
||||
@param2 int=0,
|
||||
@p3 nvarchar(20)
|
||||
AS
|
||||
@@ -0,0 +1,3 @@
|
||||
Create Procedure dbo.P1
|
||||
@param1 int
|
||||
AS
|
||||
@@ -0,0 +1,11 @@
|
||||
CREATE PROCEDURE [dbo].[usp_With]
|
||||
/* some */
|
||||
@param1 int = 0,
|
||||
@param2 /*sql*/ int
|
||||
With
|
||||
RECOMPILE
|
||||
/*comments */
|
||||
AS
|
||||
-- here
|
||||
SELECT @param1, @param2
|
||||
RETURN 0
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
CREATE PROCEDURE [dbo].[sp1]
|
||||
AS
|
||||
SELECT c1, c2
|
||||
from [dbo].[T1]
|
||||
RETURN 0
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Create Procedure dbo.P1
|
||||
AS
|
||||
@@ -0,0 +1,13 @@
|
||||
Create Procedure [dbo].[P1]
|
||||
AS
|
||||
Begin
|
||||
With
|
||||
myCTE
|
||||
AS
|
||||
(
|
||||
select c1
|
||||
from T1
|
||||
)
|
||||
select c1
|
||||
from myCTE
|
||||
End
|
||||
@@ -0,0 +1,5 @@
|
||||
CREATE PROCEDURE [dbo].[ExecAsdbo]
|
||||
WITH
|
||||
ENCRYPTION
|
||||
FOR REPLICATION
|
||||
AS
|
||||
@@ -0,0 +1,5 @@
|
||||
CREATE PROCEDURE [dbo].[ExecAsdbo]
|
||||
WITH
|
||||
EXECUTE AS 'dbo'
|
||||
FOR REPLICATION
|
||||
AS
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE PROCEDURE [dbo].[ExecAsdbo]
|
||||
WITH
|
||||
/*first module*/
|
||||
ENCRYPTION,
|
||||
-- second module
|
||||
RECOMPILE,
|
||||
/* third module */
|
||||
EXECUTE AS 'dbo'
|
||||
FOR REPLICATION
|
||||
AS
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
CREATE TABLE [Person].[Address]
|
||||
(
|
||||
[AddressID] INT IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
|
||||
CONSTRAINT [PK_Address_AddressID] PRIMARY KEY CLUSTERED ([AddressID] ASC),
|
||||
|
||||
[AddressLine1] NVARCHAR (60) NOT NULL,
|
||||
|
||||
[AddressLine2] NVARCHAR (60) NULL,
|
||||
|
||||
Address NVarChar (60) Null,
|
||||
|
||||
[City] NVARCHAR (30) NOT NULL,
|
||||
|
||||
[StateProvinceID] INT NOT NULL,
|
||||
|
||||
[PostalCode] NVARCHAR (15) NOT NULL,
|
||||
[rowguid] UNIQUEIDENTIFIER CONSTRAINT [DF_Address_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] DATETIME CONSTRAINT [DF_Address_ModifiedDate] DEFAULT (getdate()) NOT NULL,
|
||||
|
||||
|
||||
CONSTRAINT [FK_Address_StateProvince_StateProvinceID] FOREIGN KEY ([StateProvinceID]) REFERENCES [Person].[StateProvince] ([StateProvinceID]) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
CREATE TABLE [Person].[Address]
|
||||
(
|
||||
[AddressID] INT IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
|
||||
CONSTRAINT [PK_Address_AddressID] PRIMARY KEY CLUSTERED ([AddressID] ASC),
|
||||
|
||||
[AddressLine1] NVARCHAR (60) NOT NULL,
|
||||
|
||||
[AddressLine2] NVARCHAR (60) NULL,
|
||||
|
||||
Address NVarChar (60) Null,
|
||||
|
||||
[City] NVARCHAR (30) NOT NULL,
|
||||
|
||||
[StateProvinceID] INT NOT NULL,
|
||||
|
||||
[PostalCode] NVARCHAR (15) NOT NULL,
|
||||
[rowguid] UNIQUEIDENTIFIER CONSTRAINT [DF_Address_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] DATETIME CONSTRAINT [DF_Address_ModifiedDate] DEFAULT (getdate()) NOT NULL,
|
||||
|
||||
|
||||
CONSTRAINT [FK_Address_StateProvince_StateProvinceID] FOREIGN KEY ([StateProvinceID]) REFERENCES [Person].[StateProvince] ([StateProvinceID]) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE db_name.schema_name.table_name
|
||||
(
|
||||
col_name1 INT,
|
||||
col_name2 VARCHAR (20)
|
||||
|
||||
|
||||
-- here is my comment
|
||||
)
|
||||
ON partition_schema_name (partition_column_name);
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL
|
||||
|
||||
-- this is a comment before Title
|
||||
,[Title] NVARCHAR (50) NOT NULL
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
,[FileName] NVARCHAR (400) NOT NULL
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
,[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
create table t1
|
||||
(
|
||||
id INT not null /* awesome */
|
||||
,x INT not null
|
||||
/* cool */
|
||||
,y INT not null
|
||||
-- tremendeous
|
||||
)
|
||||
with
|
||||
(
|
||||
data_compression = row
|
||||
);
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
create table t1
|
||||
(
|
||||
col1 int,
|
||||
|
||||
col2 int
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] int IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] nvarchar (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] nvarchar (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
create table [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT identity (1, 1) not null,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) not null,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) not null,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
CREATE TABLE mytable
|
||||
(
|
||||
mycol1 int,
|
||||
timestamp
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] NVARCHAR(8)
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable]
|
||||
(
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
CREATE VIEW my_schema.my_view_name
|
||||
(
|
||||
column1,
|
||||
column2,
|
||||
column3
|
||||
)
|
||||
WITH
|
||||
SCHEMABINDING,
|
||||
ENCRYPTION,
|
||||
VIEW_METADATA
|
||||
AS
|
||||
SELECT *
|
||||
FROM mytable
|
||||
@@ -0,0 +1,25 @@
|
||||
CREATE VIEW my_schema.my_view_name
|
||||
--and
|
||||
(
|
||||
/* we */
|
||||
column1,
|
||||
column2,
|
||||
/* can */
|
||||
column3
|
||||
)
|
||||
-- put
|
||||
WITH
|
||||
/* comments */
|
||||
/*even multiple ones */
|
||||
-- and of various types
|
||||
SCHEMABINDING,
|
||||
-- everywhere
|
||||
ENCRYPTION,
|
||||
-- we
|
||||
VIEW_METADATA
|
||||
/* want*/
|
||||
AS
|
||||
/* because */
|
||||
SELECT *
|
||||
FROM mytable
|
||||
-- it's SQL
|
||||
@@ -0,0 +1,8 @@
|
||||
CREATE VIEW my_view
|
||||
(
|
||||
mycol,
|
||||
my_other_col
|
||||
)
|
||||
AS
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1,8 @@
|
||||
CREATE VIEW my_view_name
|
||||
WITH
|
||||
SCHEMABINDING,
|
||||
ENCRYPTION,
|
||||
VIEW_METADATA
|
||||
AS
|
||||
SELECT *
|
||||
FROM mytable
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
CREATE VIEW my_view
|
||||
(
|
||||
mycol
|
||||
)
|
||||
AS
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE VIEW my_view
|
||||
(
|
||||
mycol
|
||||
)
|
||||
WITH
|
||||
ENCRYPTION
|
||||
AS
|
||||
select *
|
||||
from mytable
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
CREATE VIEW my_view
|
||||
WITH
|
||||
ENCRYPTION
|
||||
AS
|
||||
select *
|
||||
from mytable
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
CREATE VIEW my_view
|
||||
AS
|
||||
select *
|
||||
from mytable
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
INSERT INTO NUMBERS
|
||||
DEFAULT VALUES;
|
||||
@@ -0,0 +1,20 @@
|
||||
with
|
||||
my_initial_table( column1, column2 )
|
||||
AS
|
||||
(
|
||||
select *
|
||||
from mytable
|
||||
),
|
||||
my_other_table( column1, column2 )
|
||||
AS
|
||||
(
|
||||
select *
|
||||
from mytable
|
||||
)
|
||||
Insert top (10) PERCENT
|
||||
into myserver.mydatabase.myschema.mytable_or_view WITH (TABLOCK)
|
||||
( col1, col2, col3, col4, col5 )
|
||||
VALUES
|
||||
( DEFault, NULL, 1, N'My Value', 'Today'),
|
||||
( 45, 5, 1, N'My Last Value', 'Yesterday'),
|
||||
( 8, 6, 1, N'My Next Value', 'Tomorrow')
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
INSERT OPENQUERY (OracleSvr, 'SELECT name FROM joe.titles')
|
||||
-- comment
|
||||
VALUES
|
||||
('NewTitle');
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
INSERT Production.ScrapReason
|
||||
OUTPUT
|
||||
INSERTED.ScrapReasonID, INSERTED.Name, INSERTED.ModifiedDate
|
||||
INTO @MyTableVar
|
||||
VALUES
|
||||
(N'Operator error', GETDATE());
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
INSERT Production.ScrapReason
|
||||
/*comments like this one*/
|
||||
OUTPUT
|
||||
INSERTED.ScrapReasonID, INSERTED.Name, INSERTED.ModifiedDate
|
||||
INTO @MyTableVar
|
||||
VALUES
|
||||
(N'Operator error',/*comments like this one*/ GETDATE());
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
INSERT INTO myTable
|
||||
(FileName, FileType, Document)
|
||||
SELECT
|
||||
'Text1.txt' AS FileName,
|
||||
'.txt' AS FileType,
|
||||
*
|
||||
FROM
|
||||
OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document;
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
INSERT INTO myTable
|
||||
(FileName, FileType, Document)
|
||||
--comment
|
||||
SELECT
|
||||
'Text1.txt' AS FileName,
|
||||
'.txt' AS FileType,
|
||||
*
|
||||
FROM
|
||||
OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document;
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
insert top (10)
|
||||
into mytable
|
||||
values
|
||||
(10, 11);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
insert top (10)
|
||||
mytable
|
||||
/*comments like this one*//*comments like this one*/
|
||||
values
|
||||
/*comments like this one*/
|
||||
(10, 11);
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
select c1, c2, t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From t1, t2, t3
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
select
|
||||
c1,
|
||||
c2,
|
||||
t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From
|
||||
t1,
|
||||
t2,
|
||||
t3
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
select c1 ,c2 ,t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From t1 ,t2 ,t3
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
select
|
||||
c1,
|
||||
c2,
|
||||
t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From
|
||||
t1,
|
||||
t2,
|
||||
t3
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
select
|
||||
c1
|
||||
,c2
|
||||
,t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From
|
||||
t1
|
||||
,t2
|
||||
,t3
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
select c1, c2, t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From t1, t2, t3
|
||||
|
||||
for browse
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
select c1, c2, t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From t1, t2, t3
|
||||
|
||||
FOR XML AUTO, TYPE, XMLSCHEMA, ELEMENTS XSINIL;
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
select
|
||||
c1,
|
||||
c2,
|
||||
t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
from
|
||||
t1,
|
||||
t2,
|
||||
t3
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
SELECT
|
||||
c1,
|
||||
c2,
|
||||
t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
FROM
|
||||
t1,
|
||||
t2,
|
||||
t3
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
select
|
||||
c1,
|
||||
c2,
|
||||
t3.c3
|
||||
|
||||
|
||||
|
||||
|
||||
From
|
||||
t1,
|
||||
t2,
|
||||
t3
|
||||
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE [Person].[Address] (
|
||||
[AddressID] INT IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
|
||||
CONSTRAINT [PK_Address_AddressID] PRIMARY KEY CLUSTERED ([AddressID] ASC),
|
||||
|
||||
[AddressLine1] NVARCHAR (60) NOT NULL,
|
||||
|
||||
[AddressLine2] NVARCHAR (60) NULL,
|
||||
|
||||
Address NVarChar (60) Null,
|
||||
|
||||
[City] NVARCHAR (30) NOT NULL,
|
||||
|
||||
[StateProvinceID] INT NOT NULL,
|
||||
|
||||
[PostalCode] NVARCHAR (15) NOT NULL,
|
||||
[rowguid] UNIQUEIDENTIFIER CONSTRAINT [DF_Address_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] DATETIME CONSTRAINT [DF_Address_ModifiedDate] DEFAULT (getdate()) NOT NULL,
|
||||
|
||||
|
||||
CONSTRAINT [FK_Address_StateProvince_StateProvinceID] FOREIGN KEY ([StateProvinceID]) REFERENCES [Person].[StateProvince] ([StateProvinceID]) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
@@ -0,0 +1,5 @@
|
||||
CREATE TABLE [Person].[Address] (
|
||||
[AddressID] INT IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
|
||||
CONSTRAINT [PK_Address_AddressID] PRIMARY KEY CLUSTERED ([AddressID] ASC),[AddressLine1] NVARCHAR (60) NOT NULL,
|
||||
);
|
||||
--closing comment
|
||||
@@ -0,0 +1,5 @@
|
||||
select *
|
||||
from mytable
|
||||
intersect
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
seLect *
|
||||
from mytable
|
||||
unIon
|
||||
selECT *
|
||||
fROM mytable
|
||||
union ALL
|
||||
select *
|
||||
from mytable
|
||||
excepT
|
||||
select *
|
||||
from mytable
|
||||
Intersect
|
||||
select *
|
||||
from mytable
|
||||
@@ -0,0 +1 @@
|
||||
select * from mytable union select * from mytable except select * from mytable union all select * from mytable intersect select * from mytable
|
||||
@@ -0,0 +1,18 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH Sales_CTE (SalesPersonID, SalesOrderID, SalesYear)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT SalesPersonID, SalesOrderID, YEAR(OrderDate) AS SalesYear
|
||||
FROM Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT SalesPersonID, COUNT(SalesOrderID) AS TotalSales, SalesYear
|
||||
FROM Sales_CTE
|
||||
GROUP BY SalesYear, SalesPersonID
|
||||
ORDER BY SalesPersonID, SalesYear;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
with my_initial_table( column1, column2 ) AS ( select * from mytable ), my_other_table( column1X, column2X ) AS ( select * from mytable2 ) select distinct top (10) PERCENT with ties alias1 = SIZE(mytable.mycol1), another = COUNT(new_elements), count(money) AS encore, id INTO my_new_table FROM my_initial_table
|
||||
@@ -0,0 +1,16 @@
|
||||
USE AdventureWorks2008R2;
|
||||
GO
|
||||
-- Define the CTE expression name and column list.
|
||||
WITH Sales_CTE (SalesOrderID)
|
||||
AS
|
||||
-- Define the CTE query.
|
||||
(
|
||||
SELECT SalesOrderID
|
||||
FROM Sales.SalesOrderHeader
|
||||
WHERE SalesPersonID IS NOT NULL
|
||||
)
|
||||
-- Define the outer query referencing the CTE name.
|
||||
SELECT COUNT(SalesOrderID) AS TotalSales
|
||||
FROM Sales_CTE;
|
||||
GO
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE PROCEDURE au_info
|
||||
@lastname varchar(40),
|
||||
@firstname varchar(20)
|
||||
AS
|
||||
SELECT au_lname, au_fname, title, pub_name
|
||||
FROM authors a INNER JOIN titleauthor ta
|
||||
ON a.au_id = ta.au_id INNER JOIN titles t
|
||||
ON t.title_id = ta.title_id INNER JOIN publishers p
|
||||
ON t.pub_id = p.pub_id
|
||||
WHERE au_fname = @firstname
|
||||
AND au_lname = @lastname
|
||||
GO
|
||||
@@ -0,0 +1,4 @@
|
||||
-- a numbered procedure containing
|
||||
-- which is an obsolete feature and will be removed
|
||||
/* in the future */ create procedure p1;2 /* this right here is a parameter */ @p2 nvarchar(20) as -- useless comment
|
||||
select @p2
|
||||
@@ -0,0 +1 @@
|
||||
create procedure [Ugly.Schema].ProcWithUglySchema as /*this is comment 1*/ begin /* this-is-comment-2! */ select 1 end
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
-- my comment
|
||||
Create Procedure P1 AS
|
||||
@@ -0,0 +1,3 @@
|
||||
create procedure [Ugly.Schema].ProcWithUglySchema as begin select 1 end
|
||||
go
|
||||
CREATE PROCEDURE [dbo].[cursorVaryingColumn] @cursorCol CURSOR VARYING OUTPUT AS SELECT 'A'
|
||||
@@ -0,0 +1 @@
|
||||
Create Procedure dbo.P1 @param1 int, @cursorCol CURSOR VARYING OUTPUT, @param2 int=0, @p3 nvarchar(20) AS
|
||||
@@ -0,0 +1 @@
|
||||
Create Procedure dbo.P1 @param1 int AS
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE PROCEDURE [dbo].[usp_With] /* some */ @param1 int = 0, @param2 /*sql*/ int With RECOMPILE /*comments */ AS -- here
|
||||
SELECT @param1, @param2 RETURN 0
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
CREATE PROCEDURE [dbo].[sp1] AS SELECT c1, c2 from [dbo].[T1] RETURN 0
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Create Procedure dbo.P1 AS
|
||||
@@ -0,0 +1 @@
|
||||
Create Procedure [dbo].[P1] AS Begin With myCTE AS (select c1 from T1 ) select c1 from myCTE End
|
||||
@@ -0,0 +1 @@
|
||||
CREATE PROCEDURE [dbo].[ExecAsdbo] WITH ENCRYPTION FOR REPLICATION AS
|
||||
@@ -0,0 +1 @@
|
||||
CREATE PROCEDURE [dbo].[ExecAsdbo] WITH EXECUTE AS 'dbo' FOR REPLICATION AS
|
||||
@@ -0,0 +1,4 @@
|
||||
CREATE PROCEDURE [dbo].[ExecAsdbo] WITH /*first module*/ ENCRYPTION,
|
||||
-- second module
|
||||
RECOMPILE,
|
||||
/* third module */ EXECUTE AS 'dbo' FOR REPLICATION AS
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
-- this is a comment before create table
|
||||
CREATE TABLE [SimpleTable] (
|
||||
|
||||
-- this is a comment before document
|
||||
[DocumentID] INT IDENTITY (1, 1) NOT NULL,
|
||||
|
||||
-- this is a comment before Title
|
||||
[Title] NVARCHAR (50) NOT NULL,
|
||||
|
||||
|
||||
-- this is a comment before FileName
|
||||
[FileName] NVARCHAR (400) NOT NULL,
|
||||
|
||||
-- this is a comment before FileExtension
|
||||
[FileExtension] nvarchar(8)
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE
|
||||
db_name.schema_name.table_name
|
||||
(
|
||||
col_name1 INT,
|
||||
col_name2 VARCHAR (20)
|
||||
|
||||
|
||||
-- here is my comment
|
||||
)
|
||||
ON partition_schema_name (partition_column_name);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user