Skip to content

Sreeja-Deb/SQLServer-Data-Lineage

 
 

Repository files navigation

SQLServer Data Lineage for T-SQL Queries

Data Lineage Transact SQL (T-SQL) for Microsoft 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.

Cloning the repository

You can follow the steps below to clone the repository.

git clone https://github.com/tomaztk/SQLServer-Data-Lineage.git

Removing comments from your code

Clean your code of in-line and multiple lines of --comments or slash star comments from better visibility and greater readability.

  1. Run the support files

Run helper_fun.sql helper file, that will create a sample data tables and example procedure. In addition, run a remove_comments.sql file to create a procedure with stripping and removing all the comments from your T-SQL query.

  1. Removing comments from T-SQL Query

Strip and remove all comments from your T-SQL query by using dbo.remove_comments procedure.

# Run procedure dbo.remove_comments

EXEC dbo.remove_comments
   @procedure_name = N'sql_sample_procedure'

Quickstart for Data Lineage on T-SQL

  1. Clone the repository
  2. Have your T-SQL query ready
  3. Load the DataLineage table function with your query
# Run
DECLARE @t_sql_query NVARCHAR(MAX)
SET @t_sql_query = N'-- Query
SELECT top 10 
 [name]
,object_id
--,principal_id
--,schema_did
,schema_id
from sys.tables'


SELECT dbo.fn_datalineage(@t_sql_query)

Follow and more on blog posts

Remove comments from your T-SQL code (Blog post)

Collaboration and contributors

Ideas, code collaboration or any other contributions of any kind is highly appreciated! Fork the repository, add your code.

Write mathematical formulas in Markdown using $ prefix

Write the following formula $\sqrt{3x-1}+(1+x)^2$ and it will be rendered as:

$\sqrt{3x-1}+(1+x)^2$

About

Data Lineage for Microsoft SQL Server

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TSQL 100.0%