Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sunny_10
Yak Posting Veteran
72 Posts |
Posted - 2014-03-06 : 01:49:44
|
Hi In the below procedure i want value should be returned if the stored procedure is executed successfullyCreate PROCEDURE [dbo].[Sp_backup] -- Add the parameters for the stored procedure here@path VARCHAR(256) ,@dbname varchar(50)ASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- specify database backup directoryDECLARE @fileName VARCHAR(256) -- filename for backup DECLARE @fileDate VARCHAR(20) -- used for file name-- specify filename format SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) DECLARE db_cursor CURSOR FOR SELECT name FROM master.dbo.sysdatabases WHERE name IN (@dbname) OPEN db_cursor FETCH NEXT FROM db_cursor INTO @dbname WHILE @@FETCH_STATUS = 0 BEGIN SET @fileName = @path + @dbname + '_' + @fileDate + '.BAK' BACKUP DATABASE @dbname TO DISK = @fileName FETCH NEXT FROM db_cursor INTO @dbname END CLOSE db_cursor DEALLOCATE db_cursorEND |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-03-06 : 06:07:55
|
http://stackoverflow.com/questions/19145518/how-to-know-tsql-stored-procedure-update-executedJaveed Ahmed |
|
|
|
|
|