Skip to content

Commit 2d5c408

Browse files
committed
update readme.md
1 parent 63de08d commit 2d5c408

File tree

1 file changed

+68
-40
lines changed

1 file changed

+68
-40
lines changed

README.md

Lines changed: 68 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,95 @@
1-
# SQLServer Data Lineage for T-SQL Queries
1+
# Data Lineage for Microsoft SQL Server T-SQL Queries
22

33
Data Lineage Transact SQL (T-SQL) for [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server) enables you to find the data origins and data destinations in your query. It gives you the visibility over query data columns and ability to track the changes over time.
44

5-
## Cloning the repository
6-
You can follow the steps below to clone the repository.
7-
```
8-
git clone https://github.com/tomaztk/SQLServer-Data-Lineage.git
9-
```
105

11-
# Removing comments from your code
6+
# Features
7+
8+
* Remove any kind of comments from your T-SQL code
9+
* Remove any special characters from your T-SQL code
10+
* Generate data lineage from your T-SQL Code
11+
* Learn interesting facts about your data and get better analytics
12+
13+
14+
15+
# Removing comments from your T-SQL code
1216
Clean your code of in-line and multiple lines of _--comments_ or _slash star_ comments from better visibility and greater readability.
1317

1418
<a href="https://tomaztsql.files.wordpress.com/2021/07/2021-07-13-05_24_06-window.png"><img width="50%" src="https://tomaztsql.files.wordpress.com/2021/07/2021-07-13-05_24_06-window.png"/>
1519
</a>
1620

21+
Run **Remove_comments.sql** to create a procedure.
22+
Strip and remove all comments from your T-SQL query by using _dbo.remove_comments_ procedure
1723

18-
1. Run the support files
24+
``` sql
25+
-- Run procedure dbo.remove_comments
1926

20-
Run **helper_fun.sql** helper file, that will create a sample data tables and example procedure.
21-
In addition, run a **remove_comments.sql** file to create a procedure with stripping and removing all the comments from your T-SQL query.
27+
EXEC dbo.remove_comments
28+
@procedure_name = N'dbo.MySample_procedure'
2229

23-
2. Removing comments from T-SQL Query
30+
```
2431

25-
Strip and remove all comments from your T-SQL query by using _dbo.remove_comments_ procedure.
2632

27-
``` sql
28-
# Run procedure dbo.remove_comments
33+
# Start with Data Lineage on T-SQL
34+
35+
Run **TSQL_data_lineage.sql** file to create a lineage procedure. This script includes the removal of comments and special characters and creates the data lineage.
2936

30-
EXEC dbo.remove_comments
31-
@procedure_name = N'sql_sample_procedure'
3237

38+
```sql
39+
-- Get your query:
40+
declare @test_query VARCHAR(8000) = '
41+
42+
SELECT
43+
s.[BusinessEntityID]
44+
,p.[Title]
45+
,p.[FirstName]
46+
,p.[MiddleName]
47+
,p.[LastName]
48+
,p.[Suffix]
49+
,e.[JobTitle] as imeSluzbe
50+
,p.[EmailPromotion]
51+
,s.[SalesQuota]
52+
,s.[SalesYTD]
53+
,s.[SalesLastYear]
54+
,( SELECT GETDATE() ) AS DateNow
55+
,( select count(*) FROM [AdventureWorks2014].sales.[SalesPerson] ) as totalSales
56+
57+
FROM [AdventureWorks2014].sales.[SalesPerson] s
58+
LEFT JOIN [AdventureWorks2014].[HumanResources].[Employee] e
59+
ON e.[BusinessEntityID] = s.[BusinessEntityID]
60+
INNER JOIN [AdventureWorks2014].[Person].[Person] AS p
61+
ON p.[BusinessEntityID] = s.[BusinessEntityID]
62+
63+
'
64+
65+
-- And run the procedure with single input parameter
66+
EXEC dbo.TSQL_data_lineage
67+
@InputQuery = @test_query
3368
```
3469

70+
# Requirements
3571

36-
# Quickstart for Data Lineage on T-SQL
72+
The script works with any of the following versions:
3773

38-
1. Clone the repository
39-
2. Have your T-SQL query ready
40-
3. Load the DataLineage table function with your query
74+
* Microsoft SQL Server database (works on all editions and versions 2016+)
75+
* Azure SQL Database
76+
* Azure SQL Server
77+
* Azure SQL MI
4178

4279

43-
``` sql
44-
# Run
45-
DECLARE @t_sql_query NVARCHAR(MAX)
46-
SET @t_sql_query = N'-- Query
47-
SELECT top 10
48-
[name]
49-
,object_id
50-
--,principal_id
51-
--,schema_did
52-
,schema_id
53-
from sys.tables'
54-
55-
56-
SELECT dbo.fn_datalineage(@t_sql_query)
80+
81+
Get started
82+
===========
83+
The easiest way to get started is with fork or clone the repository.
84+
85+
86+
## Cloning the repository
87+
You can follow the steps below to clone the repository.
88+
```
89+
git clone https://github.com/tomaztk/SQLServer-Data-Lineage.git
5790
```
5891

59-
## Follow and more on blog posts
92+
## Read more on blog posts
6093

6194
Remove comments from your T-SQL code ([Blog post](https://tomaztsql.wordpress.com/2021/07/13/remove-comments-from-your-t-sql-code/))
6295

@@ -65,8 +98,3 @@ Remove comments from your T-SQL code ([Blog post](https://tomaztsql.wordpress.co
6598
Ideas, code collaboration or any other contributions of any kind is highly appreciated!
6699
Fork the repository, add your code.
67100

68-
## Write mathematical formulas in Markdown using `$` prefix
69-
70-
Write the following formula `$\sqrt{3x-1}+(1+x)^2$` and it will be rendered as:
71-
72-
$\sqrt{3x-1}+(1+x)^2$

0 commit comments

Comments
 (0)