I need the backup of only the structure of database, not the data.
I tried, this procedure , but it is copying the whole database
create Procedure BackupAlldataba ses
as
declare cur_databases cursor for
select name from master..sysdata bases where name not in
('tempdb','mast er','Northwind' ,'pubs','model' ,'msdb')
open cur_databases
declare @path varchar(100), @DBName varchar(100), @BackupPath
varchar(100), @cleardbs varchar(100),@d ay varchar(2),@mon th
varchar(2),@yea r varchar(4)
set @Path = '\\sdg_bankaler t3\BA_Project_B ackUp\SDG_BA25'
fetch next from cur_databases into @DBName
While (@@fetch_status = 0)
BEGIN
set @month= Case when len(month(getda te()))=1 then
'0'+Cast(month( getdate()) as varchar) else Cast(month(getd ate()) as
varchar) end
set @day=Case when len(day(getdate ()))=1 then '0'+Cast(day(ge tdate()) as
varchar) else Cast(day(getdat e()) as varchar) end
set @year=year( GETDATE() )
--set @BackupPath = @Path + '\'+@month+'-'+
@year+'\'+@mont h+'-'+@day+'-'+ @year+'\'+'sdg_ ba25'+'\'+ @DBName + '.bak'
set @BackupPath = @Path + @DBName + '.bak'
print @BackupPath
backup database @DBName to disk = @BackupPath with init
fetch next from cur_databases into @DBName
END
Please if any one can give me the solution...
With regards,
winsletmathew
I tried, this procedure , but it is copying the whole database
create Procedure BackupAlldataba ses
as
declare cur_databases cursor for
select name from master..sysdata bases where name not in
('tempdb','mast er','Northwind' ,'pubs','model' ,'msdb')
open cur_databases
declare @path varchar(100), @DBName varchar(100), @BackupPath
varchar(100), @cleardbs varchar(100),@d ay varchar(2),@mon th
varchar(2),@yea r varchar(4)
set @Path = '\\sdg_bankaler t3\BA_Project_B ackUp\SDG_BA25'
fetch next from cur_databases into @DBName
While (@@fetch_status = 0)
BEGIN
set @month= Case when len(month(getda te()))=1 then
'0'+Cast(month( getdate()) as varchar) else Cast(month(getd ate()) as
varchar) end
set @day=Case when len(day(getdate ()))=1 then '0'+Cast(day(ge tdate()) as
varchar) else Cast(day(getdat e()) as varchar) end
set @year=year( GETDATE() )
--set @BackupPath = @Path + '\'+@month+'-'+
@year+'\'+@mont h+'-'+@day+'-'+ @year+'\'+'sdg_ ba25'+'\'+ @DBName + '.bak'
set @BackupPath = @Path + @DBName + '.bak'
print @BackupPath
backup database @DBName to disk = @BackupPath with init
fetch next from cur_databases into @DBName
END
Please if any one can give me the solution...
With regards,
winsletmathew
Comment