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

Database

 
GeneralRe: How do I Backup all the Databases on Server 1 and Append Restore the Backup on Server 2 so it gets all the changes in the First Server, I will do this with 7 Servers in Progression so they Loop Every 15 Minutes. Pin
Wendelius22-Jan-09 4:35
mentorWendelius22-Jan-09 4:35 
GeneralRe: How do I Backup all the Databases on Server 1 and Append Restore the Backup on Server 2 so it gets all the changes in the First Server, I will do this with 7 Servers in Progression so they Loop Every 15 Minutes. Pin
BobClarkSQL22-Jan-09 4:40
BobClarkSQL22-Jan-09 4:40 
GeneralRe: How do I Backup all the Databases on Server 1 and Append Restore the Backup on Server 2 so it gets all the changes in the First Server, I will do this with 7 Servers in Progression so they Loop Every 15 Minutes. Pin
BobClarkSQL22-Jan-09 4:52
BobClarkSQL22-Jan-09 4:52 
GeneralRe: How do I Backup all the Databases on Server 1 and Append Restore the Backup on Server 2 so it gets all the changes in the First Server, I will do this with 7 Servers in Progression so they Loop Every 15 Minutes. Pin
Wendelius22-Jan-09 5:06
mentorWendelius22-Jan-09 5:06 
GeneralRe: How do I Backup all the Databases on Server 1 and Append Restore the Backup on Server 2 so it gets all the changes in the First Server, I will do this with 7 Servers in Progression so they Loop Every 15 Minutes. Pin
BobClarkSQL22-Jan-09 5:42
BobClarkSQL22-Jan-09 5:42 
QuestionInsert query and Cursor in same stored procedure Pin
Jay Royall21-Jan-09 23:28
Jay Royall21-Jan-09 23:28 
AnswerRe: Insert query and Cursor in same stored procedure Pin
Wendelius21-Jan-09 23:33
mentorWendelius21-Jan-09 23:33 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall21-Jan-09 23:49
Jay Royall21-Jan-09 23:49 
Thanks for your time.

I understand what you're saying about cursors being a performance hog, but there are going to be at most 30 records in this table so I didn't think using a cursor would have too much of an impact. Am I wrong in thinkign this?

Anyway, here is my procedure:

ALTER PROCEDURE [dbo].[spReportTabINSERT] 
	-- Add the parameters for the stored procedure here
	@prmName as varchar(30),
	@prmSequence as int
AS
BEGIN
	SET NOCOUNT ON;

	INSERT INTO
		tblReportTabs
		(
			[name],
			[Sequence]
		)
	VALUES
		(
			@prmName,
			@prmSequence
		)	

	-- update all  sequences
	DECLARE @ID uniqueidentifier
	DECLARE @Sequence int
	DECLARE @NewSequence int

	SET @NewSequence = 10

	DECLARE crsTabs CURSOR
	FOR
		SELECT
			tblReportTabs.[ID],
			tblReportTabs.[Sequence]
		FROM
			tblReportTabs
		ORDER BY
			tblReportTabs.[Sequence]

	OPEN crsTabs

	FETCH NEXT FROM crsTabs INTO @ID, @Sequence

	WHILE @@FETCH_STATUS = 0
	BEGIN
		UPDATE
			tblReportTabs
		SET
			tblReportTabs.[Sequence] = @NewSequence
		WHERE
			tblReportTabs.[ID] = @ID

		SET @NewSequence = @NewSequence + 10

		FETCH NEXT FROM crsTabs 
	END
END

CLOSE crsTabs
DEALLOCATE crsTabs

GeneralRe: Insert query and Cursor in same stored procedure Pin
Wendelius22-Jan-09 0:00
mentorWendelius22-Jan-09 0:00 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall22-Jan-09 0:05
Jay Royall22-Jan-09 0:05 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Wendelius22-Jan-09 0:13
mentorWendelius22-Jan-09 0:13 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall22-Jan-09 0:21
Jay Royall22-Jan-09 0:21 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Wendelius22-Jan-09 0:29
mentorWendelius22-Jan-09 0:29 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Ennis Ray Lynch, Jr.22-Jan-09 6:23
Ennis Ray Lynch, Jr.22-Jan-09 6:23 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall22-Jan-09 6:31
Jay Royall22-Jan-09 6:31 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Ennis Ray Lynch, Jr.22-Jan-09 6:36
Ennis Ray Lynch, Jr.22-Jan-09 6:36 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall22-Jan-09 9:38
Jay Royall22-Jan-09 9:38 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Ennis Ray Lynch, Jr.22-Jan-09 9:46
Ennis Ray Lynch, Jr.22-Jan-09 9:46 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall22-Jan-09 9:52
Jay Royall22-Jan-09 9:52 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Wendelius22-Jan-09 9:50
mentorWendelius22-Jan-09 9:50 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall22-Jan-09 9:56
Jay Royall22-Jan-09 9:56 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Wendelius22-Jan-09 10:05
mentorWendelius22-Jan-09 10:05 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Jay Royall22-Jan-09 21:31
Jay Royall22-Jan-09 21:31 
GeneralRe: Insert query and Cursor in same stored procedure Pin
Wendelius22-Jan-09 21:36
mentorWendelius22-Jan-09 21:36 
AnswerRe: Insert query and Cursor in same stored procedure [modified] Pin
omlac21-Jan-09 23:35
omlac21-Jan-09 23:35 

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.