|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RAISERROR??I am trying use: sp_addmessage, RAISERROR... I have a problem. see: 1: I use 'addmessage' to add 2 messages in 'sysmessages', both whith id 50001 but one in 'us_english' and anothe in my native language 'Brazilian' But when I set my language 'SET LANGUAGE Brazilian' RAISERROR returns me only: Msg 50001, Level 1, State 50001 and if I set my language 'SET LANGUAGE us_english RAISERROR returns me full message: 'Msg 50001, Level 1, State 50001 The status of POS is: 1, and can not be activated.' what's wrong? Thanks See my complete code: ---------------------------------------------------------------------------------------------------- use master ---------------------------------------------------------------------------------------------------- SELECT * FROM sysmessages WHERE error > 50000 -- ============================================= -- Add User Messages -- ------------------------------------------------ sp_addmessage @msgnum = 50001, @severity = 1, @msgtext = N'The status of POS is: %d, and can not be activated.', @lang = 'us_english' GO sp_addmessage @msgnum = 50001, @severity = 1, @msgtext = N'O estado do terminal é: %d, e o mesmo não pode ser ativado.', @lang = 'Brazilian' GO -- ============================================= -- Drop User Messages -- ------------------------------------------------ EXEC sp_dropmessage @msgnum = 50001, @lang = 'us_english' EXEC sp_dropmessage @msgnum = 50001, @lang = 'Brazilian' -- ============================================= -- Test -- ------------------------------------------------ SET LANGUAGE Brazilian GO SET LANGUAGE us_english GO RAISERROR (50001, 1, 1, 1) The parameters for the us messages dictates the position number for the other messages. Try below:
sp_addmessage @msgnum = 50001, @severity = 1, @msgtext = N'O estado do terminal é: %1!, e o mesmo não pode ser ativado.', @lang = 'Brazilian' -- Show quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ Blog: http://solidqualitylearning.com/blogs/tibor/ "ReTF" <re.tf@newsgroup.nospam> wrote in message news:ecT525WqFHA.4088@TK2MSFTNGP15.phx.gbl... > Hi All, > > > I am trying use: sp_addmessage, RAISERROR... > > I have a problem. see: > > 1: I use 'addmessage' to add 2 messages in 'sysmessages', both whith id 50001 but one in > 'us_english' and anothe in my native language 'Brazilian' > > But when I set my language 'SET LANGUAGE Brazilian' RAISERROR returns me only: Msg 50001, Level 1, > State 50001 > and if I set my language 'SET LANGUAGE us_english RAISERROR returns me full message: 'Msg 50001, > Level 1, State 50001 The status of POS is: 1, and can not be activated.' > > what's wrong? Thanks > > See my complete code: > > ---------------------------------------------------------------------------------------------------- > use master > ---------------------------------------------------------------------------------------------------- > > SELECT * FROM sysmessages WHERE error > 50000 > > -- ============================================= > -- Add User Messages -- > ------------------------------------------------ > > sp_addmessage @msgnum = 50001, @severity = 1, > @msgtext = N'The status of POS is: %d, and can not be activated.', > @lang = 'us_english' > GO > > sp_addmessage @msgnum = 50001, @severity = 1, > @msgtext = N'O estado do terminal é: %d, e o mesmo não pode ser ativado.', > @lang = 'Brazilian' > GO > > > -- ============================================= > -- Drop User Messages -- > ------------------------------------------------ > EXEC sp_dropmessage @msgnum = 50001, @lang = 'us_english' > EXEC sp_dropmessage @msgnum = 50001, @lang = 'Brazilian' > > > -- ============================================= > -- Test -- > ------------------------------------------------ > > SET LANGUAGE Brazilian > GO > > SET LANGUAGE us_english > GO > > RAISERROR (50001, 1, 1, 1) > Now works!!!
Thank you very much. Show quote "Tibor Karaszi" <tibor_please.no.email_kara***@hotmail.nomail.com> escreveu na mensagem news:%23ysP7PXqFHA.712@TK2MSFTNGP15.phx.gbl... > The parameters for the us messages dictates the position number for the > other messages. Try below: > > sp_addmessage @msgnum = 50001, @severity = 1, > @msgtext = N'O estado do terminal é: %1!, e o mesmo não pode ser > ativado.', @lang = 'Brazilian' > > > -- > Tibor Karaszi, SQL Server MVP > http://www.karaszi.com/sqlserver/default.asp > http://www.solidqualitylearning.com/ > Blog: http://solidqualitylearning.com/blogs/tibor/ > > > "ReTF" <re.tf@newsgroup.nospam> wrote in message > news:ecT525WqFHA.4088@TK2MSFTNGP15.phx.gbl... >> Hi All, >> >> >> I am trying use: sp_addmessage, RAISERROR... >> >> I have a problem. see: >> >> 1: I use 'addmessage' to add 2 messages in 'sysmessages', both whith id >> 50001 but one in 'us_english' and anothe in my native language >> 'Brazilian' >> >> But when I set my language 'SET LANGUAGE Brazilian' RAISERROR returns me >> only: Msg 50001, Level 1, State 50001 >> and if I set my language 'SET LANGUAGE us_english RAISERROR returns me >> full message: 'Msg 50001, Level 1, State 50001 The status of POS is: 1, >> and can not be activated.' >> >> what's wrong? Thanks >> >> See my complete code: >> >> ---------------------------------------------------------------------------------------------------- >> use master >> ---------------------------------------------------------------------------------------------------- >> >> SELECT * FROM sysmessages WHERE error > 50000 >> >> -- ============================================= >> -- Add User Messages -- >> ------------------------------------------------ >> >> sp_addmessage @msgnum = 50001, @severity = 1, >> @msgtext = N'The status of POS is: %d, and can not be activated.', >> @lang = 'us_english' >> GO >> >> sp_addmessage @msgnum = 50001, @severity = 1, >> @msgtext = N'O estado do terminal é: %d, e o mesmo não pode ser >> ativado.', >> @lang = 'Brazilian' >> GO >> >> >> -- ============================================= >> -- Drop User Messages -- >> ------------------------------------------------ >> EXEC sp_dropmessage @msgnum = 50001, @lang = 'us_english' >> EXEC sp_dropmessage @msgnum = 50001, @lang = 'Brazilian' >> >> >> -- ============================================= >> -- Test -- >> ------------------------------------------------ >> >> SET LANGUAGE Brazilian >> GO >> >> SET LANGUAGE us_english >> GO >> >> RAISERROR (50001, 1, 1, 1) >> > |
|||||||||||||||||||||||