play around with Scintilla and Lexilla
This commit is contained in:
		
							
								
								
									
										52
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/AllStyles.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/AllStyles.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,52 @@
 | 
			
		||||
-- Enumerate all styles: 0 to 16
 | 
			
		||||
 | 
			
		||||
/* block comment = 1*/
 | 
			
		||||
 | 
			
		||||
-- whitespace = 0
 | 
			
		||||
    -- spaces
 | 
			
		||||
 | 
			
		||||
-- line comment = 2
 | 
			
		||||
 | 
			
		||||
-- number = 3
 | 
			
		||||
376
 | 
			
		||||
 | 
			
		||||
-- string = 4
 | 
			
		||||
'a string'
 | 
			
		||||
 | 
			
		||||
-- operator = 5
 | 
			
		||||
()
 | 
			
		||||
INTERSECT
 | 
			
		||||
 | 
			
		||||
-- identifier = 6
 | 
			
		||||
ProductID;
 | 
			
		||||
 | 
			
		||||
-- variable = 7
 | 
			
		||||
@Variable;
 | 
			
		||||
 | 
			
		||||
-- column name = 8
 | 
			
		||||
"COLUMN";
 | 
			
		||||
 | 
			
		||||
-- statement = 9
 | 
			
		||||
PRINT
 | 
			
		||||
 | 
			
		||||
-- datatype = 10
 | 
			
		||||
int
 | 
			
		||||
 | 
			
		||||
-- systable = 11
 | 
			
		||||
sysobjects
 | 
			
		||||
 | 
			
		||||
-- global variable = 12
 | 
			
		||||
@@ERROR
 | 
			
		||||
 | 
			
		||||
-- function = 13
 | 
			
		||||
object_id
 | 
			
		||||
 | 
			
		||||
-- stored procedure = 14
 | 
			
		||||
sp_fulltext_database
 | 
			
		||||
 | 
			
		||||
-- default (preferencing data type) = 15
 | 
			
		||||
x --
 | 
			
		||||
 | 
			
		||||
-- column name 2 = 16
 | 
			
		||||
[COLUMN];
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										53
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/AllStyles.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/AllStyles.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
			
		||||
 0 400   0   -- Enumerate all styles: 0 to 16
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   /* block comment = 1*/
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- whitespace = 0
 | 
			
		||||
 0 400   0       -- spaces
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- line comment = 2
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- number = 3
 | 
			
		||||
 0 400   0   376
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- string = 4
 | 
			
		||||
 0 400   0   'a string'
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- operator = 5
 | 
			
		||||
 0 400   0   ()
 | 
			
		||||
 0 400   0   INTERSECT
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- identifier = 6
 | 
			
		||||
 0 400   0   ProductID;
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- variable = 7
 | 
			
		||||
 0 400   0   @Variable;
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- column name = 8
 | 
			
		||||
 0 400   0   "COLUMN";
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- statement = 9
 | 
			
		||||
 0 400   0   PRINT
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- datatype = 10
 | 
			
		||||
 0 400   0   int
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- systable = 11
 | 
			
		||||
 0 400   0   sysobjects
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- global variable = 12
 | 
			
		||||
 0 400   0   @@ERROR
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- function = 13
 | 
			
		||||
 0 400   0   object_id
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- stored procedure = 14
 | 
			
		||||
 0 400   0   sp_fulltext_database
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- default (preferencing data type) = 15
 | 
			
		||||
 0 400   0   x --
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- column name 2 = 16
 | 
			
		||||
 0 400   0   [COLUMN];
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   
 | 
			
		||||
							
								
								
									
										52
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/AllStyles.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/AllStyles.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,52 @@
 | 
			
		||||
{2}-- Enumerate all styles: 0 to 16{0}
 | 
			
		||||
 | 
			
		||||
{1}/* block comment = 1*/{0}
 | 
			
		||||
 | 
			
		||||
{2}-- whitespace = 0{0}
 | 
			
		||||
    {2}-- spaces{0}
 | 
			
		||||
 | 
			
		||||
{2}-- line comment = 2{0}
 | 
			
		||||
 | 
			
		||||
{2}-- number = 3{0}
 | 
			
		||||
{3}376{0}
 | 
			
		||||
 | 
			
		||||
{2}-- string = 4{0}
 | 
			
		||||
{4}'a string'{0}
 | 
			
		||||
 | 
			
		||||
{2}-- operator = 5{0}
 | 
			
		||||
{5}(){0}
 | 
			
		||||
{5}INTERSECT{0}
 | 
			
		||||
 | 
			
		||||
{2}-- identifier = 6{0}
 | 
			
		||||
{6}ProductID{5};{0}
 | 
			
		||||
 | 
			
		||||
{2}-- variable = 7{0}
 | 
			
		||||
{7}@Variable{5};{0}
 | 
			
		||||
 | 
			
		||||
{2}-- column name = 8{0}
 | 
			
		||||
{8}"COLUMN"{5};{0}
 | 
			
		||||
 | 
			
		||||
{2}-- statement = 9{0}
 | 
			
		||||
{9}PRINT{0}
 | 
			
		||||
 | 
			
		||||
{2}-- datatype = 10{0}
 | 
			
		||||
{10}int{0}
 | 
			
		||||
 | 
			
		||||
{2}-- systable = 11{0}
 | 
			
		||||
{11}sysobjects{0}
 | 
			
		||||
 | 
			
		||||
{2}-- global variable = 12{0}
 | 
			
		||||
{12}@@ERROR{0}
 | 
			
		||||
 | 
			
		||||
{2}-- function = 13{0}
 | 
			
		||||
{13}object_id{0}
 | 
			
		||||
 | 
			
		||||
{2}-- stored procedure = 14{0}
 | 
			
		||||
{14}sp_fulltext_database{0}
 | 
			
		||||
 | 
			
		||||
{2}-- default (preferencing data type) = 15{0}
 | 
			
		||||
{6}x{15} {2}--{0}
 | 
			
		||||
 | 
			
		||||
{2}-- column name 2 = 16{0}
 | 
			
		||||
{16}[COLUMN]{5};{0}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue87.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue87.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
/**
 | 
			
		||||
 /*
 | 
			
		||||
  GitHub Issue 87
 | 
			
		||||
  /*
 | 
			
		||||
    /****** Object:  Table [dbo].[Issue87]    Script Date: 04/06/2022 8:07:57 PM ******/
 | 
			
		||||
   */
 | 
			
		||||
  */
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										9
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue87.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue87.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
 2 400   0 + /**
 | 
			
		||||
 0 401   0 |  /*
 | 
			
		||||
 0 401   0 |   GitHub Issue 87
 | 
			
		||||
 0 401   0 |   /*
 | 
			
		||||
 0 401   0 |     /****** Object:  Table [dbo].[Issue87]    Script Date: 04/06/2022 8:07:57 PM ******/
 | 
			
		||||
 0 401   0 |    */
 | 
			
		||||
 0 401   0 |   */
 | 
			
		||||
 0 401   0 |  */
 | 
			
		||||
 0 400   0   
 | 
			
		||||
							
								
								
									
										8
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue87.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue87.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
{1}/**
 | 
			
		||||
 /*
 | 
			
		||||
  GitHub Issue 87
 | 
			
		||||
  /*
 | 
			
		||||
    /****** Object:  Table [dbo].[Issue87]    Script Date: 04/06/2022 8:07:57 PM ******/
 | 
			
		||||
   */
 | 
			
		||||
  */
 | 
			
		||||
 */{0}
 | 
			
		||||
							
								
								
									
										4
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue90.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue90.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
CREATE TABLE TestTable (
 | 
			
		||||
    col
 | 
			
		||||
    CHAR(3)
 | 
			
		||||
);
 | 
			
		||||
							
								
								
									
										5
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue90.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue90.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
 0 400   0   CREATE TABLE TestTable (
 | 
			
		||||
 0 400   0       col
 | 
			
		||||
 0 400   0       CHAR(3)
 | 
			
		||||
 0 400   0   );
 | 
			
		||||
 0 400   0   
 | 
			
		||||
							
								
								
									
										4
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue90.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Issue90.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
{9}CREATE{0} {9}TABLE{0} {6}TestTable{15} {5}({0}
 | 
			
		||||
    {6}col{15}
 | 
			
		||||
    {10}CHAR{5}({3}3{5}){0}
 | 
			
		||||
{5});{0}
 | 
			
		||||
							
								
								
									
										25
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/SciTE.properties
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/SciTE.properties
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
lexer.*.tsql=mssql
 | 
			
		||||
fold=1
 | 
			
		||||
fold.comment=1
 | 
			
		||||
 | 
			
		||||
# statement
 | 
			
		||||
keywords.*.tsql=and as begin by create declare distinct drop else end exists from go if in insert into is inner \
 | 
			
		||||
join like not null on order print procedure return select set table use values where while
 | 
			
		||||
 | 
			
		||||
# data type
 | 
			
		||||
keywords2.*.tsql=char int
 | 
			
		||||
 | 
			
		||||
# System table
 | 
			
		||||
keywords3.*.tsql=sysobjects
 | 
			
		||||
 | 
			
		||||
# global variables
 | 
			
		||||
keywords4.*.tsql=error
 | 
			
		||||
 | 
			
		||||
# functions
 | 
			
		||||
keywords5.*.tsql=ascii char object_id
 | 
			
		||||
 | 
			
		||||
# System stored procedures
 | 
			
		||||
keywords6.*.tsql=sp_fulltext_database
 | 
			
		||||
 | 
			
		||||
# operators
 | 
			
		||||
keywords7.*.tsql=intersect
 | 
			
		||||
							
								
								
									
										104
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Various.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Various.tsql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,104 @@
 | 
			
		||||
/* This file contains snippets of Transact-SQL that exercise various aspects of the language. */
 | 
			
		||||
/**
 | 
			
		||||
 /*
 | 
			
		||||
  AllStyles.tsql
 | 
			
		||||
  /*
 | 
			
		||||
    /****** Object:  Database [AllStyles]    Script Date: 06/16/2022 10:56:35 PM ******/
 | 
			
		||||
   */
 | 
			
		||||
  */
 | 
			
		||||
 */
 | 
			
		||||
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
 | 
			
		||||
BEGIN
 | 
			
		||||
    EXEC sp_fulltext_database @action = 'enable';
 | 
			
		||||
END
 | 
			
		||||
USE AllStyles;
 | 
			
		||||
GO
 | 
			
		||||
SELECT *
 | 
			
		||||
FROM Production.Product
 | 
			
		||||
ORDER BY Name ASC;
 | 
			
		||||
-- Alternate way.
 | 
			
		||||
USE AllStyles;
 | 
			
		||||
GO
 | 
			
		||||
SELECT p.*
 | 
			
		||||
FROM Production.Product AS p
 | 
			
		||||
ORDER BY Name ASC;
 | 
			
		||||
GO
 | 
			
		||||
 | 
			
		||||
SELECT "COLUMN" FROM "TABLE"
 | 
			
		||||
SELECT "COLUMN" int FROM "TABLE"
 | 
			
		||||
 | 
			
		||||
SELECT schema_name
 | 
			
		||||
    (tab.schema_id) AS schema_name
 | 
			
		||||
    -- retrieve the name, too
 | 
			
		||||
    ,tab.name
 | 
			
		||||
FROM sys.tables AS tab;
 | 
			
		||||
 | 
			
		||||
SELECT DISTINCT Name
 | 
			
		||||
FROM Production.Product AS p
 | 
			
		||||
WHERE EXISTS
 | 
			
		||||
    (SELECT *
 | 
			
		||||
     FROM Production.ProductModel AS pm
 | 
			
		||||
     WHERE p.ProductModelID = pm.ProductModelID
 | 
			
		||||
           AND pm.Name LIKE 'Long-Sleeve Logo Jersey%');
 | 
			
		||||
 | 
			
		||||
SELECT DISTINCT p.LastName, p.FirstName
 | 
			
		||||
FROM Person.Person AS p
 | 
			
		||||
JOIN HumanResources.Employee AS e
 | 
			
		||||
    ON e.BusinessEntityID = p.BusinessEntityID WHERE 5000.00 IN
 | 
			
		||||
    (SELECT Bonus
 | 
			
		||||
     FROM Sales.SalesPerson AS sp
 | 
			
		||||
     WHERE e.BusinessEntityID = sp.BusinessEntityID);
 | 
			
		||||
 | 
			
		||||
CREATE PROCEDURE findjobs @nm sysname = NULL
 | 
			
		||||
AS
 | 
			
		||||
IF @nm IS NULL
 | 
			
		||||
    BEGIN
 | 
			
		||||
        PRINT 'You must give a user name'
 | 
			
		||||
        RETURN
 | 
			
		||||
    END
 | 
			
		||||
ELSE
 | 
			
		||||
    BEGIN
 | 
			
		||||
        SELECT o.name, o.id, o.uid
 | 
			
		||||
        FROM sysobjects o INNER JOIN master.syslogins l
 | 
			
		||||
            ON o.uid = l.sid
 | 
			
		||||
        WHERE l.name = @nm
 | 
			
		||||
    END;
 | 
			
		||||
 | 
			
		||||
CREATE TABLE TestTable (cola INT, colb CHAR(3));
 | 
			
		||||
-- Declare the variable to be used.
 | 
			
		||||
DECLARE @MyCounter INT;
 | 
			
		||||
 | 
			
		||||
-- Initialize the variable.
 | 
			
		||||
SET @MyCounter = 0;
 | 
			
		||||
WHILE (@MyCounter < 26)
 | 
			
		||||
BEGIN;
 | 
			
		||||
   -- Insert a row into the table.
 | 
			
		||||
   INSERT INTO TestTable VALUES
 | 
			
		||||
       -- Use the variable to provide the integer value
 | 
			
		||||
       -- for cola. Also use it to generate a unique letter
 | 
			
		||||
       -- for each row. Use the ASCII function to get the
 | 
			
		||||
       -- integer value of 'a'. Add @MyCounter. Use CHAR to
 | 
			
		||||
       -- convert the sum back to the character @MyCounter
 | 
			
		||||
       -- characters after 'a'.
 | 
			
		||||
       (@MyCounter,
 | 
			
		||||
        CHAR( ( @MyCounter + ASCII('a') ) )
 | 
			
		||||
       );
 | 
			
		||||
   -- Increment the variable to count this iteration
 | 
			
		||||
   -- of the loop.
 | 
			
		||||
   SET @MyCounter = @MyCounter + 1;
 | 
			
		||||
END;
 | 
			
		||||
 | 
			
		||||
IF @@ERROR = 547
 | 
			
		||||
    BEGIN
 | 
			
		||||
    PRINT N'A check constraint violation occurred.';
 | 
			
		||||
    END
 | 
			
		||||
GO
 | 
			
		||||
 | 
			
		||||
USE [AllStyles].[dbo].[test]
 | 
			
		||||
GO
 | 
			
		||||
 | 
			
		||||
SELECT ProductID
 | 
			
		||||
FROM Production.Product
 | 
			
		||||
INTERSECT
 | 
			
		||||
SELECT ProductID
 | 
			
		||||
FROM Production.WorkOrder ;
 | 
			
		||||
							
								
								
									
										105
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Various.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Various.tsql.folded
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,105 @@
 | 
			
		||||
 0 400   0   /* This file contains snippets of Transact-SQL that exercise various aspects of the language. */
 | 
			
		||||
 2 400   0 + /**
 | 
			
		||||
 0 401   0 |  /*
 | 
			
		||||
 0 401   0 |   AllStyles.tsql
 | 
			
		||||
 0 401   0 |   /*
 | 
			
		||||
 0 401   0 |     /****** Object:  Database [AllStyles]    Script Date: 06/16/2022 10:56:35 PM ******/
 | 
			
		||||
 0 401   0 |    */
 | 
			
		||||
 0 401   0 |   */
 | 
			
		||||
 0 401   0 |  */
 | 
			
		||||
 0 400   0   IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
 | 
			
		||||
 2 400   0 + BEGIN
 | 
			
		||||
 0 401   0 |     EXEC sp_fulltext_database @action = 'enable';
 | 
			
		||||
 0 401   0 | END
 | 
			
		||||
 0 400   0   USE AllStyles;
 | 
			
		||||
 0 400   0   GO
 | 
			
		||||
 0 400   0   SELECT *
 | 
			
		||||
 0 400   0   FROM Production.Product
 | 
			
		||||
 0 400   0   ORDER BY Name ASC;
 | 
			
		||||
 0 400   0   -- Alternate way.
 | 
			
		||||
 0 400   0   USE AllStyles;
 | 
			
		||||
 0 400   0   GO
 | 
			
		||||
 0 400   0   SELECT p.*
 | 
			
		||||
 0 400   0   FROM Production.Product AS p
 | 
			
		||||
 0 400   0   ORDER BY Name ASC;
 | 
			
		||||
 0 400   0   GO
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   SELECT "COLUMN" FROM "TABLE"
 | 
			
		||||
 0 400   0   SELECT "COLUMN" int FROM "TABLE"
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   SELECT schema_name
 | 
			
		||||
 0 400   0       (tab.schema_id) AS schema_name
 | 
			
		||||
 0 400   0       -- retrieve the name, too
 | 
			
		||||
 0 400   0       ,tab.name
 | 
			
		||||
 0 400   0   FROM sys.tables AS tab;
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   SELECT DISTINCT Name
 | 
			
		||||
 0 400   0   FROM Production.Product AS p
 | 
			
		||||
 0 400   0   WHERE EXISTS
 | 
			
		||||
 0 400   0       (SELECT *
 | 
			
		||||
 0 400   0        FROM Production.ProductModel AS pm
 | 
			
		||||
 0 400   0        WHERE p.ProductModelID = pm.ProductModelID
 | 
			
		||||
 0 400   0              AND pm.Name LIKE 'Long-Sleeve Logo Jersey%');
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   SELECT DISTINCT p.LastName, p.FirstName
 | 
			
		||||
 0 400   0   FROM Person.Person AS p
 | 
			
		||||
 0 400   0   JOIN HumanResources.Employee AS e
 | 
			
		||||
 0 400   0       ON e.BusinessEntityID = p.BusinessEntityID WHERE 5000.00 IN
 | 
			
		||||
 0 400   0       (SELECT Bonus
 | 
			
		||||
 0 400   0        FROM Sales.SalesPerson AS sp
 | 
			
		||||
 0 400   0        WHERE e.BusinessEntityID = sp.BusinessEntityID);
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   CREATE PROCEDURE findjobs @nm sysname = NULL
 | 
			
		||||
 0 400   0   AS
 | 
			
		||||
 0 400   0   IF @nm IS NULL
 | 
			
		||||
 2 400   0 +     BEGIN
 | 
			
		||||
 0 401   0 |         PRINT 'You must give a user name'
 | 
			
		||||
 0 401   0 |         RETURN
 | 
			
		||||
 0 401   0 |     END
 | 
			
		||||
 0 400   0   ELSE
 | 
			
		||||
 2 400   0 +     BEGIN
 | 
			
		||||
 0 401   0 |         SELECT o.name, o.id, o.uid
 | 
			
		||||
 0 401   0 |         FROM sysobjects o INNER JOIN master.syslogins l
 | 
			
		||||
 0 401   0 |             ON o.uid = l.sid
 | 
			
		||||
 0 401   0 |         WHERE l.name = @nm
 | 
			
		||||
 0 401   0 |     END;
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   CREATE TABLE TestTable (cola INT, colb CHAR(3));
 | 
			
		||||
 0 400   0   -- Declare the variable to be used.
 | 
			
		||||
 0 400   0   DECLARE @MyCounter INT;
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   -- Initialize the variable.
 | 
			
		||||
 0 400   0   SET @MyCounter = 0;
 | 
			
		||||
 0 400   0   WHILE (@MyCounter < 26)
 | 
			
		||||
 2 400   0 + BEGIN;
 | 
			
		||||
 0 401   0 |    -- Insert a row into the table.
 | 
			
		||||
 0 401   0 |    INSERT INTO TestTable VALUES
 | 
			
		||||
 0 401   0 |        -- Use the variable to provide the integer value
 | 
			
		||||
 0 401   0 |        -- for cola. Also use it to generate a unique letter
 | 
			
		||||
 0 401   0 |        -- for each row. Use the ASCII function to get the
 | 
			
		||||
 0 401   0 |        -- integer value of 'a'. Add @MyCounter. Use CHAR to
 | 
			
		||||
 0 401   0 |        -- convert the sum back to the character @MyCounter
 | 
			
		||||
 0 401   0 |        -- characters after 'a'.
 | 
			
		||||
 0 401   0 |        (@MyCounter,
 | 
			
		||||
 0 401   0 |         CHAR( ( @MyCounter + ASCII('a') ) )
 | 
			
		||||
 0 401   0 |        );
 | 
			
		||||
 0 401   0 |    -- Increment the variable to count this iteration
 | 
			
		||||
 0 401   0 |    -- of the loop.
 | 
			
		||||
 0 401   0 |    SET @MyCounter = @MyCounter + 1;
 | 
			
		||||
 0 401   0 | END;
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   IF @@ERROR = 547
 | 
			
		||||
 2 400   0 +     BEGIN
 | 
			
		||||
 0 401   0 |     PRINT N'A check constraint violation occurred.';
 | 
			
		||||
 0 401   0 |     END
 | 
			
		||||
 0 400   0   GO
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   USE [AllStyles].[dbo].[test]
 | 
			
		||||
 0 400   0   GO
 | 
			
		||||
 1 400   0   
 | 
			
		||||
 0 400   0   SELECT ProductID
 | 
			
		||||
 0 400   0   FROM Production.Product
 | 
			
		||||
 0 400   0   INTERSECT
 | 
			
		||||
 0 400   0   SELECT ProductID
 | 
			
		||||
 0 400   0   FROM Production.WorkOrder ;
 | 
			
		||||
 0 400   0   
 | 
			
		||||
							
								
								
									
										104
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Various.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								3rdparty/lexilla532/lexilla/test/examples/mssql/Various.tsql.styled
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,104 @@
 | 
			
		||||
{1}/* This file contains snippets of Transact-SQL that exercise various aspects of the language. */{0}
 | 
			
		||||
{1}/**
 | 
			
		||||
 /*
 | 
			
		||||
  AllStyles.tsql
 | 
			
		||||
  /*
 | 
			
		||||
    /****** Object:  Database [AllStyles]    Script Date: 06/16/2022 10:56:35 PM ******/
 | 
			
		||||
   */
 | 
			
		||||
  */
 | 
			
		||||
 */{0}
 | 
			
		||||
{9}IF{0} {5}({3}1{0} {5}={0} {6}FULLTEXTSERVICEPROPERTY{5}({4}'IsFullTextInstalled'{5})){0}
 | 
			
		||||
{9}BEGIN{0}
 | 
			
		||||
    {6}EXEC{15} {14}sp_fulltext_database{0} {7}@action{15} {5}={0} {4}'enable'{5};{0}
 | 
			
		||||
{9}END{0}
 | 
			
		||||
{9}USE{0} {6}AllStyles{5};{0}
 | 
			
		||||
{9}GO{0}
 | 
			
		||||
{9}SELECT{0} {5}*{0}
 | 
			
		||||
{9}FROM{0} {6}Production.Product{15}
 | 
			
		||||
{9}ORDER{0} {9}BY{0} {6}Name{15} {6}ASC{5};{0}
 | 
			
		||||
{2}-- Alternate way.{0}
 | 
			
		||||
{9}USE{0} {6}AllStyles{5};{0}
 | 
			
		||||
{9}GO{0}
 | 
			
		||||
{9}SELECT{0} {6}p.{5}*{0}
 | 
			
		||||
{9}FROM{0} {6}Production.Product{15} {9}AS{0} {6}p{15}
 | 
			
		||||
{9}ORDER{0} {9}BY{0} {6}Name{15} {6}ASC{5};{0}
 | 
			
		||||
{9}GO{0}
 | 
			
		||||
 | 
			
		||||
{9}SELECT{0} {8}"COLUMN"{15} {9}FROM{0} {8}"TABLE"{15}
 | 
			
		||||
{9}SELECT{0} {8}"COLUMN"{15} {10}int{0} {9}FROM{0} {8}"TABLE"{15}
 | 
			
		||||
 | 
			
		||||
{9}SELECT{0} {6}schema_name{15}
 | 
			
		||||
    {5}({6}tab.schema_id{5}){0} {9}AS{0} {6}schema_name{15}
 | 
			
		||||
    {2}-- retrieve the name, too{0}
 | 
			
		||||
    {5},{6}tab.name{15}
 | 
			
		||||
{9}FROM{0} {6}sys.tables{15} {9}AS{0} {6}tab{5};{0}
 | 
			
		||||
 | 
			
		||||
{9}SELECT{0} {9}DISTINCT{0} {6}Name{15}
 | 
			
		||||
{9}FROM{0} {6}Production.Product{15} {9}AS{0} {6}p{15}
 | 
			
		||||
{9}WHERE{0} {9}EXISTS{0}
 | 
			
		||||
    {5}({9}SELECT{0} {5}*{0}
 | 
			
		||||
     {9}FROM{0} {6}Production.ProductModel{15} {9}AS{0} {6}pm{15}
 | 
			
		||||
     {9}WHERE{0} {6}p.ProductModelID{15} {5}={0} {6}pm.ProductModelID{15}
 | 
			
		||||
           {9}AND{0} {6}pm.Name{15} {9}LIKE{0} {4}'Long-Sleeve Logo Jersey%'{5});{0}
 | 
			
		||||
 | 
			
		||||
{9}SELECT{0} {9}DISTINCT{0} {6}p.LastName{5},{0} {6}p.FirstName{15}
 | 
			
		||||
{9}FROM{0} {6}Person.Person{15} {9}AS{0} {6}p{15}
 | 
			
		||||
{9}JOIN{0} {6}HumanResources.Employee{15} {9}AS{0} {6}e{15}
 | 
			
		||||
    {9}ON{0} {6}e.BusinessEntityID{15} {5}={0} {6}p.BusinessEntityID{15} {9}WHERE{0} {3}5000.00{0} {9}IN{0}
 | 
			
		||||
    {5}({9}SELECT{0} {6}Bonus{15}
 | 
			
		||||
     {9}FROM{0} {6}Sales.SalesPerson{15} {9}AS{0} {6}sp{15}
 | 
			
		||||
     {9}WHERE{0} {6}e.BusinessEntityID{15} {5}={0} {6}sp.BusinessEntityID{5});{0}
 | 
			
		||||
 | 
			
		||||
{9}CREATE{0} {9}PROCEDURE{0} {6}findjobs{0} {7}@nm{15} {6}sysname{15} {5}={0} {9}NULL{0}
 | 
			
		||||
{9}AS{0}
 | 
			
		||||
{9}IF{0} {7}@nm{15} {9}IS{0} {9}NULL{0}
 | 
			
		||||
    {9}BEGIN{0}
 | 
			
		||||
        {9}PRINT{0} {4}'You must give a user name'{0}
 | 
			
		||||
        {9}RETURN{0}
 | 
			
		||||
    {9}END{0}
 | 
			
		||||
{9}ELSE{0}
 | 
			
		||||
    {9}BEGIN{0}
 | 
			
		||||
        {9}SELECT{0} {6}o.name{5},{0} {6}o.id{5},{0} {6}o.uid{15}
 | 
			
		||||
        {9}FROM{0} {11}sysobjects{0} {6}o{15} {9}INNER{0} {9}JOIN{0} {6}master.syslogins{15} {6}l{15}
 | 
			
		||||
            {9}ON{0} {6}o.uid{15} {5}={0} {6}l.sid{15}
 | 
			
		||||
        {9}WHERE{0} {6}l.name{15} {5}={0} {7}@nm{15}
 | 
			
		||||
    {9}END{5};{0}
 | 
			
		||||
 | 
			
		||||
{9}CREATE{0} {9}TABLE{0} {6}TestTable{15} {5}({6}cola{15} {10}INT{5},{0} {6}colb{15} {10}CHAR{5}({3}3{5}));{0}
 | 
			
		||||
{2}-- Declare the variable to be used.{0}
 | 
			
		||||
{9}DECLARE{0} {7}@MyCounter{15} {10}INT{5};{0}
 | 
			
		||||
 | 
			
		||||
{2}-- Initialize the variable.{0}
 | 
			
		||||
{9}SET{0} {7}@MyCounter{15} {5}={0} {3}0{5};{0}
 | 
			
		||||
{9}WHILE{0} {5}({7}@MyCounter{15} {5}<{0} {3}26{5}){0}
 | 
			
		||||
{9}BEGIN{5};{0}
 | 
			
		||||
   {2}-- Insert a row into the table.{0}
 | 
			
		||||
   {9}INSERT{0} {9}INTO{0} {6}TestTable{15} {9}VALUES{0}
 | 
			
		||||
       {2}-- Use the variable to provide the integer value{0}
 | 
			
		||||
       {2}-- for cola. Also use it to generate a unique letter{0}
 | 
			
		||||
       {2}-- for each row. Use the ASCII function to get the{0}
 | 
			
		||||
       {2}-- integer value of 'a'. Add @MyCounter. Use CHAR to{0}
 | 
			
		||||
       {2}-- convert the sum back to the character @MyCounter{0}
 | 
			
		||||
       {2}-- characters after 'a'.{0}
 | 
			
		||||
       {5}({7}@MyCounter{5},{0}
 | 
			
		||||
        {13}CHAR{5}({0} {5}({0} {7}@MyCounter{15} {5}+{0} {13}ASCII{5}({4}'a'{5}){0} {5}){0} {5}){0}
 | 
			
		||||
       {5});{0}
 | 
			
		||||
   {2}-- Increment the variable to count this iteration{0}
 | 
			
		||||
   {2}-- of the loop.{0}
 | 
			
		||||
   {9}SET{0} {7}@MyCounter{15} {5}={0} {7}@MyCounter{15} {5}+{0} {3}1{5};{0}
 | 
			
		||||
{9}END{5};{0}
 | 
			
		||||
 | 
			
		||||
{9}IF{0} {12}@@ERROR{0} {5}={0} {3}547{0}
 | 
			
		||||
    {9}BEGIN{0}
 | 
			
		||||
    {9}PRINT{0} {6}N{4}'A check constraint violation occurred.'{5};{0}
 | 
			
		||||
    {9}END{0}
 | 
			
		||||
{9}GO{0}
 | 
			
		||||
 | 
			
		||||
{9}USE{0} {16}[AllStyles]{5}.{16}[dbo]{5}.{16}[test]{15}
 | 
			
		||||
{9}GO{0}
 | 
			
		||||
 | 
			
		||||
{9}SELECT{0} {6}ProductID{15}
 | 
			
		||||
{9}FROM{0} {6}Production.Product{15}
 | 
			
		||||
{5}INTERSECT{0}
 | 
			
		||||
{9}SELECT{0} {6}ProductID{15}
 | 
			
		||||
{9}FROM{0} {6}Production.WorkOrder{15} {5};{0}
 | 
			
		||||
		Reference in New Issue
	
	Block a user