Click here to Skip to main content
15,902,635 members
Home / Discussions / Database
   

Database

 
GeneralRe: error in restore Pin
NarendraSinghJTV21-Dec-09 23:49
NarendraSinghJTV21-Dec-09 23:49 
GeneralRe: error in restore Pin
Vimalsoft(Pty) Ltd22-Dec-09 2:24
professionalVimalsoft(Pty) Ltd22-Dec-09 2:24 
GeneralRe: error in restore Pin
NarendraSinghJTV22-Dec-09 18:02
NarendraSinghJTV22-Dec-09 18:02 
GeneralRe: error in restore Pin
Vimalsoft(Pty) Ltd22-Dec-09 18:52
professionalVimalsoft(Pty) Ltd22-Dec-09 18:52 
Questionget encrypted passwords from sql using encryption string Pin
220821-Dec-09 17:21
220821-Dec-09 17:21 
AnswerRe: get encrypted passwords from sql using encryption string Pin
Jörgen Andersson21-Dec-09 21:19
professionalJörgen Andersson21-Dec-09 21:19 
Questionstored procedure for restore .bak file Pin
NarendraSinghJTV21-Dec-09 17:11
NarendraSinghJTV21-Dec-09 17:11 
AnswerRe: stored procedure for restore .bak file Pin
Vimalsoft(Pty) Ltd22-Dec-09 2:26
professionalVimalsoft(Pty) Ltd22-Dec-09 2:26 
i have this

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- Restore a backed up database
-- Given: the filename and path where the backedup database file is located and the name of the database to restore it as
-- The entry will be restored and a row placed into oDirect.dbo.tbl_dbref - which keeps track of the databases
-- The users for the database must also be restored!
ALTER PROCEDURE [dbo].[sp_RestoreDatabase] 

	@dbname char(32), 				-- the database name to restore as
	@filename char(64), @path char(256)		-- the location of the backuped up database file	(on the SQL Server)

AS

set nocount on

declare @sql nvarchar(3000)

execute('sp_ClearDatabaseConnections ' + @dbname)

-- Restore the database
select @sql = 			' RESTORE DATABASE ' + ltrim(rtrim( @dbname )) + ' FROM DISK = ''' + ltrim(rtrim(@path)) + ltrim(rtrim( @filename )) + ''' ' 
select @sql = ltrim(rtrim(@sql)) + 	'    WITH '
select @sql = ltrim(rtrim(@sql)) + 	'    MOVE ''' + 'TNGoedit_Data' + ''' TO ''' + ltrim(rtrim(@path)) + ltrim(rtrim( @dbname )) + '.mdf' + ''' , '	-- logical file name to physical name
select @sql = ltrim(rtrim(@sql)) + 	'    MOVE ''' + 'TNGoedit_Log' + ''' TO ''' + ltrim(rtrim(@path)) + ltrim(rtrim( @dbname )) + '_log.ldf' + ''' '	-- logical file name to physical name
select @sql = ltrim(rtrim(@sql)) +  '    ,REPLACE,RECOVERY;'
--select @sql = ltrim(rtrim(@sql)) + 	'    MOVE ''' + ltrim(rtrim(@dbname)) + '_Data' + ''' TO ''' + ltrim(rtrim(@path)) + ltrim(rtrim( @dbname )) + '.mdf' + ''' , '	-- logical file name to physical name
--select @sql = ltrim(rtrim(@sql)) + 	'    MOVE ''' + ltrim(rtrim(@dbname)) + '_Log' + ''' TO ''' + ltrim(rtrim(@path)) + ltrim(rtrim( @dbname )) + '_log.ldf' + ''' '	-- logical file name to physical name
print @sql
execute ( @sql )

-- Was the command successful or was there a problem
if ( (select @@Error) = 0 ) begin
	-- Put an entry into oDirect.dbo.tbl_dbRef
	-- execute ( 'sp_DataSet_Save ''' + @xml + ''' ' ) 	

	-- TODO: restore the users

  select 'Restore Successful' [Result]
end
else begin
   select 'Restore Unsuccessful' [Result]
end


You can Simply change it to BAK file

Vuyiswa Maseko,

Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

QuestionHelp building Trigger for updating summary table [modified] Pin
MAW3021-Dec-09 11:29
MAW3021-Dec-09 11:29 
AnswerRe: Help building Trigger for updating summary table Pin
Mycroft Holmes21-Dec-09 23:56
professionalMycroft Holmes21-Dec-09 23:56 
Questiontransaction error Pin
ademsandeepreddy20-Dec-09 19:53
ademsandeepreddy20-Dec-09 19:53 
AnswerRe: transaction error Pin
Member 450194023-Dec-09 7:31
Member 450194023-Dec-09 7:31 
QuestionNeed help with creating dynamic SQL statement Pin
James Shao20-Dec-09 17:54
James Shao20-Dec-09 17:54 
AnswerRe: Need help with creating dynamic SQL statement Pin
Mycroft Holmes21-Dec-09 11:00
professionalMycroft Holmes21-Dec-09 11:00 
QuestionNeed help with DATEDIFF function Pin
James Shao20-Dec-09 17:29
James Shao20-Dec-09 17:29 
AnswerRe: Need help with DATEDIFF function Pin
Ashfield21-Dec-09 0:27
Ashfield21-Dec-09 0:27 
GeneralRe: Need help with DATEDIFF function Pin
James Shao21-Dec-09 13:33
James Shao21-Dec-09 13:33 
Questioncannot excute script Pin
#Jet19-Dec-09 16:17
#Jet19-Dec-09 16:17 
AnswerRe: cannot excute script Pin
Eddy Vluggen20-Dec-09 0:08
professionalEddy Vluggen20-Dec-09 0:08 
GeneralRe: cannot excute script Pin
#Jet20-Dec-09 7:37
#Jet20-Dec-09 7:37 
GeneralRe: cannot excute script Pin
Mycroft Holmes20-Dec-09 12:14
professionalMycroft Holmes20-Dec-09 12:14 
GeneralRe: cannot excute script Pin
#Jet20-Dec-09 12:52
#Jet20-Dec-09 12:52 
QuestionDistributed DB Pin
piotr.zielinski19-Dec-09 7:55
piotr.zielinski19-Dec-09 7:55 
AnswerRe: Distributed DB Pin
Eddy Vluggen19-Dec-09 10:20
professionalEddy Vluggen19-Dec-09 10:20 
GeneralRe: Distributed DB Pin
piotr.zielinski19-Dec-09 10:24
piotr.zielinski19-Dec-09 10:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.