SPR_UpdateRegisterNameFromActivity

For sharing any stored procedures
Post Reply
User avatar
robinwilson16
Site Admin
Posts: 184
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16

SPR_UpdateRegisterNameFromActivity

Post by robinwilson16 » Fri Mar 03, 2017 12:09 am

Sets the name of a register from the attached activity to save entering in two places

Code: Select all

CREATE PROCEDURE [dbo].[SPR_UpdateRegisterNameFromActivity](@NumRecords int OUTPUT) 
AS

BEGIN
	SET NOCOUNT ON;

    UPDATE R
	SET R.r_name = A.a_name
	FROM ulive.dbo.capd_register R
	INNER JOIN ulive.dbo.capd_activity A
		ON A.a_register = R.r_id
	WHERE
		R.r_name IS NULL
		AND A.a_name IS NOT NULL

	SET @NumRecords = @@ROWCOUNT
END

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest