SET ANSI_NULLS ON;
SET ARITHABORT ON;
SET QUOTED_IDENTIFIER ON;
SET NOCOUNT ON;
Declare @SEQUENCE_SCHEMA varchar(max);
Declare @SEQUENCE_NAME varchar(max);
DECLARE @command nvarchar(4000);
DECLARE SEQUENCE_SCHEMA CURSOR FOR SELECT DISTINCT [SEQUENCE_SCHEMA] FROM [clone].[dbo].[table_seq_curated] where SEQUENCE_SCHEMA <>'INFORMATION_SCHEMA' ORDER BY SEQUENCE_SCHEMA;
open SEQUENCE_SCHEMA;
fetch next from SEQUENCE_SCHEMA into @SEQUENCE_SCHEMA;
while @@FETCH_STATUS = 0
Begin
DECLARE SEQUENCE_NAME CURSOR FOR SELECT [SEQUENCE_NAME] FROM [clone]. [dbo].[table_seq_curated] WHERE SEQUENCE_SCHEMA=@SEQUENCE_SCHEMA ORDER BY SEQUENCE_NAME;
open SEQUENCE_NAME;
fetch next from SEQUENCE_NAME into @SEQUENCE_NAME;
while @@FETCH_STATUS = 0
BEGIN
Set @command = N'create or replace sequence PRE_PROD_CURATED.'+@SEQUENCE_SCHEMA+'.'+@SEQUENCE_NAME+' start with 10502977 increment by 1;';
print @command
--execute (@command);
fetch next from SEQUENCE_NAME into @SEQUENCE_NAME
END
CLOSE SEQUENCE_NAME;
DEALLOCATE SEQUENCE_NAME;
fetch next from SEQUENCE_SCHEMA into @SEQUENCE_SCHEMA;
END
close SEQUENCE_SCHEMA;
deallocate SEQUENCE_SCHEMA;
top of page
Search
Recent Posts
See Allselect distinct count(query_id) as total_query --,QUERY_TEXT --,DATABASE_NAME --,SCHEMA_NAME --,QUERY_TYPE --,USER_NAME --,ROLE_NAME...
100
select GRANTEE_NAME AS "USERNAME", ROLE from SNOWFLAKE.ACCOUNT_USAGE.GRANTS_TO_USERS where DELETED_ON is null and Role = 'ROLENAME' and...
70
select Total_Elapsed_Time/60000 Total_Time_MINS, Database_name, schema_name, User_name, Role_name, Warehouse_name, Warehouse_size,...
20
bottom of page
Comments