Created
February 22, 2022 08:38
-
-
Save UstDoesTech/eebdac85a5f7e979bb2ce04b253b6487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE Operation.CreateDeltaView | |
( | |
@QualifiedName NVARCHAR(300), | |
@Location NVARCHAR(200) | |
) | |
AS | |
DECLARE @DropStatement NVARCHAR(MAX) = 'DROP VIEW IF EXISTS '+ @QualifiedName +';' | |
PRINT (@DropStatement) | |
EXEC sp_executesql @DropStatement | |
DECLARE @CreateStatement NVARCHAR(MAX) = 'CREATE VIEW ' + @QualifiedName + ' AS | |
SELECT * FROM | |
OPENROWSET( | |
BULK ''' + @Location + ''', | |
DATA_SOURCE = ''DataLakeMI'', | |
FORMAT = ''DELTA'' | |
) AS [result]' | |
PRINT (@CreateStatement) | |
EXEC sp_executesql @CreateStatement |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment