Showing posts with label avail. Show all posts
Showing posts with label avail. Show all posts

Sunday, February 12, 2012

CAST in raise error

Is there anyway to CAST or CONVERT an integer within RAISERROR?
I have tried all sorts of permeations to no avail, I have to declare another
variable and CAST into that to use it in the RAISERROR.
SET RAISERROR(101002,16,1,@.errorstring, (SELECT @.pid = CAST(@.pid as
varchar(15)),@.uid)
SET RAISERROR(101002,16,1,@.errorstring,CONVE
RT(varchar(15),@.pid),@.uid)Hi
You may want to change the definition of your message to use %d instead, or
try:
DECLARE @.charpid varchar(15)
SET @.charpid = CONVERT(varchar(15),@.pid)
SET RAISERROR(101002,16,1,@.errorstring,@.char
pid,@.uid)
John
"DazedAndConfused" wrote:

> Is there anyway to CAST or CONVERT an integer within RAISERROR?
> I have tried all sorts of permeations to no avail, I have to declare anoth
er
> variable and CAST into that to use it in the RAISERROR.
> SET RAISERROR(101002,16,1,@.errorstring, (SELECT @.pid = CAST(@.pid as
> varchar(15)),@.uid)
> SET RAISERROR(101002,16,1,@.errorstring,CONVE
RT(varchar(15),@.pid),@.uid)
>
>|||Thank you, I had seen the %d in an example last w but drew a blank last
night when I needed it.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:B30FBE89-42BA-4541-8627-86ED08BC6DE9@.microsoft.com...
> Hi
> You may want to change the definition of your message to use %d instead,
> or
> try:
> DECLARE @.charpid varchar(15)
> SET @.charpid = CONVERT(varchar(15),@.pid)
> SET RAISERROR(101002,16,1,@.errorstring,@.char
pid,@.uid)
> John
> "DazedAndConfused" wrote:
>