hi all
i hv created a stord Procdure in sql server 05 for restore of database from .bak file.........but when i am callin it from asp.net it ig giving errors...in syntax.....
............. ALTER PROCEDURE [dbo].[TestRecovery]
-- Add the parameters for the stored procedure here @DatabaseName VARCHAR(50)
AS SET NOCOUNT ON; BEGIN DECLARE @FileName AS NVARCHAR(100) DECLARE @Path AS NVARCHAR(100) DECLARE @RecoveryCommand AS NVARCHAR(1000) SET @FileName = '''C:\SQL2005Backups\'+ @DatabaseName + '\Full'+ LEFT(REPLACE(CONVERT(VARCHAR(25), GETDATE(),108), ':', ''), 4) + '.BAK''' SET @Path = 'C:\SQL2005Backups\'+ @DatabaseName SET @RecoveryCommand=' Restore database '+ @DatabaseName + 'from disk = ' + @FileName +'with move'+ @DatabaseName+ ' to'+@Path +'.mdf, move'+ @DatabaseName+'_log to' +@Path +'.ldf '
EXECUTE sp_executesql @RecoveryCommand End .................
plz help whrs is the error
|
| Author: Danasegarane.A 04 Dec 2008 | Member Level: Diamond | Rating:  Points: 0 |
What is the Exact Error msg ?
Thanks and Regards, Danasegarane Arunachalam
|
| Author: Danasegarane.A 04 Dec 2008 | Member Level: Diamond | Rating:  Points: 0 |
What is the Exact Error msg ?
Thanks and Regards, Danasegarane Arunachalam
|
| Author: juhee 04 Dec 2008 | Member Level: Gold | Rating:  Points: 3 |
hi Danasegarane
these r the errors
Incorrect syntax near 'disk'. Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon. The label 'toC' has already been declared. Label names must be unique within a query batch or stored procedure.
|
| Author: Jayabalaji B 04 Dec 2008 | Member Level: Silver | Rating:  Points: 3 |
ALTER procedure [dbo].[sp_Usr_ClientName] @intClientType int, @intUsrID numeric(18,0), @intCountryId int, @intStateID int, @intCityID int as begin
select g.chvClientName,g.intCustID from tbl_Usr_General g where flgGeneral=1 and g.intClientType=@intClientType and g.intUsrID=@intUsrID and g.intCountryId=@intCountryId and g.intStateID=@intStateID and g.intCityID=@intCityID end
B.Jayabalaji, balarefutes@gmail.com
|