Click here to Skip to main content
15,896,505 members
Home / Discussions / Database
   

Database

 
AnswerRe: Database Restore Error TSQL Pin
Wendelius15-Jan-09 22:02
mentorWendelius15-Jan-09 22:02 
GeneralRe: Database Restore Error TSQL Pin
Vimalsoft(Pty) Ltd15-Jan-09 22:24
professionalVimalsoft(Pty) Ltd15-Jan-09 22:24 
GeneralRe: Database Restore Error TSQL Pin
Wendelius15-Jan-09 22:59
mentorWendelius15-Jan-09 22:59 
GeneralRe: Database Restore Error TSQL Pin
Vimalsoft(Pty) Ltd15-Jan-09 23:01
professionalVimalsoft(Pty) Ltd15-Jan-09 23:01 
GeneralRe: Database Restore Error TSQL Pin
Wendelius15-Jan-09 23:11
mentorWendelius15-Jan-09 23:11 
GeneralRe: Database Restore Error TSQL Pin
Vimalsoft(Pty) Ltd15-Jan-09 23:25
professionalVimalsoft(Pty) Ltd15-Jan-09 23:25 
GeneralRe: Database Restore Error TSQL Pin
Wendelius15-Jan-09 23:33
mentorWendelius15-Jan-09 23:33 
GeneralRe: Database Restore Error TSQL Pin
Vimalsoft(Pty) Ltd15-Jan-09 23:41
professionalVimalsoft(Pty) Ltd15-Jan-09 23:41 
Thanks i have Change the SP to look like this and it compiled fine ,

Create PROCEDURE [dbo].[sp_RestoreDatabase] <br />
<br />
	@dbname char(32), 	-- the database name to restore as<br />
	@filename char(32),<br />
	@Results int OUTPUT<br />
  <br />
AS<br />
<br />
set nocount on<br />
<br />
declare @path char(64)<br />
declare @dbmdf char(64)<br />
declare @dbldf char(64)<br />
set @path = 'C:\DATABASES\' 	-- the location of the backuped up database file	(on the SQL Server)<br />
	<br />
execute('sp_ClearDatabaseConnections ' + @dbname) --kill the existing connections to the current Database<br />
<br />
SET @filename = 'C:\DATABASES\'+ @filename<br />
set @dbmdf = 'C:\DATABASES\' + @dbname + '.mdf'<br />
set @dbldf = 'C:\DATABASES\' + @dbname +'_log.ldf'<br />
-- Restore the database<br />
RESTORE  DATABASE @dbname <br />
FROM DISK = @filename<br />
WITH MOVE 'TNGoedit_Data' TO  @dbmdf ,<br />
MOVE      'TNGoedit_Log' TO  @dbldf,<br />
REPLACE,RECOVERY;<br />
-- Was the command successful or was there a problem<br />
if ( (select @@Error) = 0 ) begin<br />
  SET  @Results = 1<br />
end<br />
else begin<br />
   SET @Results = 0<br />
end


and i tested it like this


DECLARE @Results INT
EXEC [dbo].[sp_RestoreDatabase] 'oBookingUFS','oBookingUFS',@Results out


and i got the Following Error
<br />
Msg 3234, Level 16, State 2, Procedure sp_RestoreDatabase, Line 27<br />
Logical file 'TNGoedit_Data' is not part of database 'oBookingUFS                     '. Use RESTORE FILELISTONLY to list the logical file names.<br />
Msg 3013, Level 16, State 1, Procedure sp_RestoreDatabase, Line 27<br />
RESTORE DATABASE is terminating abnormally.


Thanks

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za


GeneralRe: Database Restore Error TSQL Pin
Wendelius16-Jan-09 8:52
mentorWendelius16-Jan-09 8:52 
Question2 basic transaction issues Pin
George_George15-Jan-09 20:21
George_George15-Jan-09 20:21 
AnswerRe: 2 basic transaction issues Pin
Wendelius15-Jan-09 20:57
mentorWendelius15-Jan-09 20:57 
GeneralRe: 2 basic transaction issues Pin
George_George15-Jan-09 21:37
George_George15-Jan-09 21:37 
GeneralRe: 2 basic transaction issues Pin
Wendelius15-Jan-09 21:54
mentorWendelius15-Jan-09 21:54 
GeneralRe: 2 basic transaction issues Pin
George_George15-Jan-09 22:42
George_George15-Jan-09 22:42 
GeneralRe: 2 basic transaction issues Pin
Wendelius16-Jan-09 9:07
mentorWendelius16-Jan-09 9:07 
AnswerRe: 2 basic transaction issues Pin
Ashfield15-Jan-09 21:02
Ashfield15-Jan-09 21:02 
GeneralRe: 2 basic transaction issues Pin
George_George15-Jan-09 21:24
George_George15-Jan-09 21:24 
GeneralRe: 2 basic transaction issues Pin
Ashfield16-Jan-09 1:17
Ashfield16-Jan-09 1:17 
GeneralRe: 2 basic transaction issues Pin
George_George15-Jan-09 21:38
George_George15-Jan-09 21:38 
GeneralRe: 2 basic transaction issues Pin
Ashfield16-Jan-09 1:18
Ashfield16-Jan-09 1:18 
QuestionTime Addition Problem Pin
AliAmjad14-Jan-09 19:22
AliAmjad14-Jan-09 19:22 
AnswerRe: Time Addition Problem Pin
Wendelius15-Jan-09 4:13
mentorWendelius15-Jan-09 4:13 
GeneralDifference between MS SQL and ORACLE Pin
Subin Alex14-Jan-09 16:48
Subin Alex14-Jan-09 16:48 
GeneralRe: Difference between MS SQL and ORACLE Pin
Ashfield14-Jan-09 21:12
Ashfield14-Jan-09 21:12 
GeneralRe: Difference between MS SQL and ORACLE Pin
Wendelius15-Jan-09 0:41
mentorWendelius15-Jan-09 0:41 

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.