Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_altermessage

  No additional text.


Syntax
create procedure sys.sp_altermessage
	@message_id       int,
	@parameter        sysname,
	@parameter_value  varchar(5)
as
	declare @msg	varchar(128)
	declare @log	bit
	select @parameter = UPPER (@parameter collate Latin1_General_CI_AS)

	-- Must be ServerAdmin to manage messages
	if is_srvrolemember('serveradmin') = 0
	begin
		raiserror(15247,-1,-1)
		return (1)
	end

	-- Message id must be > 50000
	if @message_id < 50001
	begin
		raiserror(15178,-1,-1)
		return(1)
	end

	-- Is Parameter 'WITH_LOG'?
	if (@parameter <> 'WITH_LOG')
	begin
		raiserror(15176,-1,-1)
		return (1)
	end

	-- Is ParameterValue TRUE or FALSE?
	select @log = (case @parameter_value
		when 'TRUE'	then 1
		when 'FALSE' then 0
		end)
	if @log is null
	begin
		raiserror(15277,-1,-1)
		return (1)
	end

	BEGIN TRANSACTION
	-- Does this message exist?
	EXEC %%ErrorMessage(ID = @message_id).Lock(Exclusive = 1)
	if @@error <> 0
	begin
		COMMIT TRANSACTION
		raiserror(15179,-1,-1,@message_id)
		return (1)
	end

	declare @msg_str nvarchar(50)
	set @msg_str = @message_id

	-- Turn event log on or off
	EXEC %%ErrorMessage(ID = @message_id).SetEventLog(EventLog = @log)
	
	-- EMDEventType(x_eet_Alter_Message), EMDUniversalClass(x_eunc_Message), src major id, src minor id, src name
	-- -1 means ignore target stuff, target major id, target minor id, target name,
	-- # of parameters, 5 parameters
	EXEC %%System().FireTrigger(ID = 215, ID = 106, ID = @message_id, ID = 0, Value = @msg_str,
		ID = -1, ID = 0, ID = 0, Value = NULL,
		ID = 3, Value = @message_id, Value = @parameter, Value = @parameter_value, Value = NULL, Value = NULL, Value = NULL, Value = NULL)

	COMMIT TRANSACTION

	return (0)	-- sp_altermessage

 
Last revision 2008RTM
News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash