
declare @name sysname
declare @count int
declare @cmd varchar(max)

set @count=0

declare dblist cursor for select name from master.sys.sysdatabases where name not in ('master','model','tempdb','msdb')

open dblist
fetch next from dblist into @name

while @@FETCH_STATUS=0
begin
	set @cmd = 'BACKUP DATABASE [' + @name + '] TO  DISK = N''E:\Backup\NixxisSQL.bak'' WITH NOFORMAT, ' + case when @count=0 then 'INIT' else 'NOINIT' end + ', NAME = N''Batch backup'', SKIP, NOREWIND, NOUNLOAD,  STATS = 10'
	set @count=@count+1
	print @cmd
	exec (@cmd)
	fetch next from dblist into @name
end

close dblist
deallocate dblist
