Click here to Skip to main content
15,914,924 members
Home / Discussions / Database
   

Database

 
GeneralRe: sdf VS mdf Pin
Mohammad Dayyan16-Jan-09 2:58
Mohammad Dayyan16-Jan-09 2:58 
GeneralRe: sdf VS mdf Pin
Steve Hansen16-Jan-09 3:00
Steve Hansen16-Jan-09 3:00 
QuestionFalse Result at a SQLite Query [modified] Pin
Marty Glaubitz16-Jan-09 2:24
Marty Glaubitz16-Jan-09 2:24 
GeneralRe: False Result at a SQLite Query Pin
Luc Pattyn16-Jan-09 2:36
sitebuilderLuc Pattyn16-Jan-09 2:36 
QuestionGetting Count(*) ,SQL Server query for below requirement.. Pin
K V Sekhar15-Jan-09 23:13
K V Sekhar15-Jan-09 23:13 
AnswerRe: Getting Count(*) ,SQL Server query for below requirement.. Pin
Caio Kinzel Filho15-Jan-09 23:51
Caio Kinzel Filho15-Jan-09 23:51 
GeneralRe: Getting Count(*) ,SQL Server query for below requirement.. Pin
K V Sekhar16-Jan-09 0:05
K V Sekhar16-Jan-09 0:05 
QuestionDatabase Restore Error TSQL Pin
Vimalsoft(Pty) Ltd15-Jan-09 21:33
professionalVimalsoft(Pty) Ltd15-Jan-09 21:33 
Good Morning ALL

I want to Restore a database, i have the Following SP

Create PROCEDURE [dbo].[sp_RestoreDatabase] 

	@dbname char(32), 	-- the database name to restore as
	@filename char(32),
	@Results int OUTPUT
  
AS

set nocount on

declare @path char(256)
set @path = 'C:\DATABASES\' 	-- the location of the backuped up database file	(on the SQL Server)

execute('sp_ClearDatabaseConnections ' + @dbname) --kill the existing connections to the current Database

-- Restore the database
RESTORE DATABASE  @dbname 
FROM DISK ='C:\DATABASES\'+ @filename
WITH MOVE 'TNGoedit_Data' TO 'C:\DATABASES\'+ @dbname + '.mdf' ,
MOVE      'TNGoedit_Log' TO 'C:\DATABASES\'+ @dbname + '_log.ldf',
REPLACE,RECOVERY;
-- Was the command successful or was there a problem
if ( (select @@Error) = 0 ) begin
  SET  @Results = 1
end
else begin
   SET @Results = 0
end


When i Compile this SP i get the Following Error

Msg 102, Level 15, State 1, Procedure sp_RestoreDatabase, Line 27<br />
Incorrect syntax near '+'.


Where is my Problem

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


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 
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 

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.