if exists (select * from information_schema.tables where table_name = 'tmp_staging') drop table tmp_staging
GO
create table tmp_staging(sql_line varchar(2000))
GO
BULK INSERT TMP_STAGING FROM 'C:\mybigsql.sql'
GO
select * from tmp_staging
GO
declare @sql varchar(2000)
DECLARE c CURSOR FAST_FORWARD READ_ONLY FOR select sql_line from tmp_staging
OPEN c
FETCH NEXT FROM c INTO @sql
WHILE @@FETCH_STATUS = 0
BEGIN
print @sql
exec (@sql)
FETCH NEXT FROM c INTO @sql
END
CLOSE c
DEALLOCATE c
|