Hey,
Yes you can hear right.
Now You can Backup your whole Database From Sql server using simple Stored Procedure and stored them to local machine.
It s just T-SQL Query.
First of all just create new procedure from Sql Server and put below code to new procedure.
Procedure :
This will Backup your Full Database with .bak file and saved it to your local pc path.
You can use Job or Scheduler for Automatically DB Backup using this Store Procedure.
Yes you can hear right.
Now You can Backup your whole Database From Sql server using simple Stored Procedure and stored them to local machine.
It s just T-SQL Query.
First of all just create new procedure from Sql Server and put below code to new procedure.
Procedure :
USE [DB_NAME]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[i_take_database_backup]
As begin  
declare @string1 varchar(200)
set @string1 = 'BACKUP DATABASE [DB_NAME] TO  DISK = N''YOUR LOCAL PC PATH TO SAVE\DB_NAME_BACKUP_'+ cast( replace(replace(convert(varchar(25),getdate(),120),':',''),' ','') as varchar(25))+'.bak'' WITH   NOFORMAT, NOINIT,  NAME = N''Full Database Backup'', SKIP, NOREWIND, NOUNLOAD,  STATS = 10'  exec (@string1)
end  
This will Backup your Full Database with .bak file and saved it to your local pc path.
You can use Job or Scheduler for Automatically DB Backup using this Store Procedure.
0 Comments
Post a Comment