Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Format Specifier in a String Messsage with different Collation

$
0
0

Our product is creating a  message with a format specifier {%s}.  where ever we are using the message ,we are  using  a local variable to supply the message text for RAISE error. 

Here is the Raiseerror command:

RAISERROR (777, 16, 1,@Some_String);

The message definition for 777980010 is

EXECUTE sp_addmessage @msgnum = 777, @msgtext = N' {%s} text message.', @severity = 16, @lang= 'us_english', @with_log = false, @replace = 'REPLACE'

GO

EXECUTE sp_addmessage @msgnum = 777, @msgtext = N'{%s} text message', @severity = 16, @lang = 'Japanese', @replace = 'REPLACE'

GO

When the error is being raised and caught as the  ADO.net exception , its showing the “Invalid format specification:” for Local language like Japanese but working fine on english.

So if I change the format specifier to    %1! Instead of{%s} it is working for Japanese but is breaking for English.

Can you please point me the correct format string specifiers in this context for each language?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>