Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Wednesday, March 21, 2012

Does RAISERROR store values for @@ERROR?

I tried to write some test code that looks like:
DECLARE @.ErrorValue int
sp_addmessage 50001,10,'This is a test error message'
RAISERROR (50001,10,1)
SELECT @.ErrorValue = @.@.ERROR
If @.ErrorValue <> 0 ...etc.
I expected @.ErrorValue to be 50001, since I tried to move @.@.ERROR to a
variable immediately after the line that raised the error. Instead, a zero
value was returned. Why?
If I try to replace that line with:
RAISERROR (-100,10,1)
...which generates a system error 2758 ("RAISERROR could not locate entry
for error -100 in sysmessages"), and @.ErrorValue is set to 2758, so I know
the code is working.
Does RAISERROR not set the value of @.@.ERROR?
Thanks!> I expected @.ErrorValue to be 50001, since I tried to move @.@.ERROR to a
> variable immediately after the line that raised the error. Instead, a zero
> value was returned. Why?
The behavior is described completely in the documentation for raiserror.
You can use a different severity or override the behavior with an option.|||from BOL
"When an error is raised, the error number is placed in the @.@.ERROR
function, which stores the most recently generated error number. @.@.ERROR
is set to 0 by default for messages with a severity from 1 through 10."
Your second RAISERROR itself raised an error, which is what was returned
in @.@.ERROR, so that's not really a valid test.
Joel wrote:
> I tried to write some test code that looks like:
> DECLARE @.ErrorValue int
> sp_addmessage 50001,10,'This is a test error message'
> RAISERROR (50001,10,1)
> SELECT @.ErrorValue = @.@.ERROR
> If @.ErrorValue <> 0 ...etc.
> I expected @.ErrorValue to be 50001, since I tried to move @.@.ERROR to a
> variable immediately after the line that raised the error. Instead, a zero
> value was returned. Why?
> If I try to replace that line with:
> RAISERROR (-100,10,1)
> ...which generates a system error 2758 ("RAISERROR could not locate entry
> for error -100 in sysmessages"), and @.ErrorValue is set to 2758, so I know
> the code is working.
> Does RAISERROR not set the value of @.@.ERROR?
> Thanks!|||Ahh... that worked. I just tried the same code with an error level of 12, an
d
it works fine. Thanks for the help!
"Trey Walpole" wrote:

> from BOL
> "When an error is raised, the error number is placed in the @.@.ERROR
> function, which stores the most recently generated error number. @.@.ERROR
> is set to 0 by default for messages with a severity from 1 through 10."
> Your second RAISERROR itself raised an error, which is what was returned
> in @.@.ERROR, so that's not really a valid test.
> Joel wrote:
>sql

Monday, March 19, 2012

Does not exist or access denied

Newbie thing here. When you get the message (maybe not verbatim) "SQL Server
does not exist or access denied", is there a way to tell which one it is?
Problem is, client may type in the server name wrong, or may have wrong
password. It'd be nice to know if they had the correct instance name (Server
does not exist) or the wrong credentials (access denied).
Can I differentiate between the two?
TIA,
MikeMike,
That one means the machine was not found by that name.
If it was a login failure, you'd get "Login failed for user '%ls'"
%ls will be substituted by the login you supplied.
James Hokes
"Mike Hildner" <mhildner@.afweb.com> wrote in message
news:e7ZtDK01DHA.4060@.TK2MSFTNGP11.phx.gbl...
> Newbie thing here. When you get the message (maybe not verbatim) "SQL
Server
> does not exist or access denied", is there a way to tell which one it is?
> Problem is, client may type in the server name wrong, or may have wrong
> password. It'd be nice to know if they had the correct instance name
(Server
> does not exist) or the wrong credentials (access denied).
> Can I differentiate between the two?
> TIA,
> Mike
>

Does not exist or access denied

Newbie thing here. When you get the message (maybe not verbatim) "SQL Server
does not exist or access denied", is there a way to tell which one it is?
Problem is, client may type in the server name wrong, or may have wrong
password. It'd be nice to know if they had the correct instance name (Server
does not exist) or the wrong credentials (access denied).
Can I differentiate between the two?
TIA,
MikeMike,
That one means the machine was not found by that name.
If it was a login failure, you'd get "Login failed for user '%ls'"
%ls will be substituted by the login you supplied.
James Hokes
"Mike Hildner" <mhildner@.afweb.com> wrote in message
news:e7ZtDK01DHA.4060@.TK2MSFTNGP11.phx.gbl...
quote:

> Newbie thing here. When you get the message (maybe not verbatim) "SQL

Server
quote:

> does not exist or access denied", is there a way to tell which one it is?
> Problem is, client may type in the server name wrong, or may have wrong
> password. It'd be nice to know if they had the correct instance name

(Server
quote:

> does not exist) or the wrong credentials (access denied).
> Can I differentiate between the two?
> TIA,
> Mike
>

Sunday, March 11, 2012

Does Image Control support missing images?

Is there a clever way to display an alternate image or message if the image
control cannot find the image as specified in the External URL?
In other words... we supply the image name via a field... But if the image
does not exist, we get the red X. I want to display something other than the
red X.
Any ideas?
Thanks,
JimIf you have SP1 installed, then you could use an expression like this to
"hide" non-existing external images.
=iif(Trim(Fields!ExternalImagePath.Value) = "", Nothing,
Fields!ExternalImagePath.Value)
I.e. if the image.Value expression evaluates to Nothing, no red X will be
shown.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jim L" <jim@.noaddress.com> wrote in message
news:uL31USbdEHA.1648@.TK2MSFTNGP11.phx.gbl...
> Is there a clever way to display an alternate image or message if the
image
> control cannot find the image as specified in the External URL?
> In other words... we supply the image name via a field... But if the
image
> does not exist, we get the red X. I want to display something other than
the
> red X.
> Any ideas?
> Thanks,
> Jim
>|||Thanks Robert for taking the time to respond... however...
What I am looking for is this - The field will be populated with the name of
the image, we just don't know if the image will be there or not.
The image control in ASP.Net supports this - it will display a text message
instead of the Red X.
Jim
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:%23NIFYbbdEHA.1952@.TK2MSFTNGP11.phx.gbl...
> If you have SP1 installed, then you could use an expression like this to
> "hide" non-existing external images.
> =iif(Trim(Fields!ExternalImagePath.Value) = "", Nothing,
> Fields!ExternalImagePath.Value)
> I.e. if the image.Value expression evaluates to Nothing, no red X will be
> shown.
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> "Jim L" <jim@.noaddress.com> wrote in message
> news:uL31USbdEHA.1648@.TK2MSFTNGP11.phx.gbl...
> > Is there a clever way to display an alternate image or message if the
> image
> > control cannot find the image as specified in the External URL?
> >
> > In other words... we supply the image name via a field... But if the
> image
> > does not exist, we get the red X. I want to display something other than
> the
> > red X.
> >
> > Any ideas?
> >
> > Thanks,
> > Jim
> >
> >
>|||An image in Reporting Services is not an ASP.NET image control. The desired
functionality is currently not supported. The closest you can get today is:
* either "hiding" non-existing external images through expressions as
outlined in the previous posting
* or use an expression on the Visibility property of the Image reportitem to
conditionally hide non-existing images. The expression would make a call
into a custom assembly with the image path value as parameter and would
return true if the image exists - which would then not hide the Image
reportitem. So it is doable right now, but there is some work involved to
get it done.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jim L" <jim@.noaddress.com> wrote in message
news:OWg%23LibdEHA.1356@.TK2MSFTNGP09.phx.gbl...
> Thanks Robert for taking the time to respond... however...
> What I am looking for is this - The field will be populated with the name
of
> the image, we just don't know if the image will be there or not.
> The image control in ASP.Net supports this - it will display a text
message
> instead of the Red X.
> Jim
>
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:%23NIFYbbdEHA.1952@.TK2MSFTNGP11.phx.gbl...
> > If you have SP1 installed, then you could use an expression like this to
> > "hide" non-existing external images.
> > =iif(Trim(Fields!ExternalImagePath.Value) = "", Nothing,
> > Fields!ExternalImagePath.Value)
> >
> > I.e. if the image.Value expression evaluates to Nothing, no red X will
be
> > shown.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> >
> >
> > "Jim L" <jim@.noaddress.com> wrote in message
> > news:uL31USbdEHA.1648@.TK2MSFTNGP11.phx.gbl...
> > > Is there a clever way to display an alternate image or message if the
> > image
> > > control cannot find the image as specified in the External URL?
> > >
> > > In other words... we supply the image name via a field... But if the
> > image
> > > does not exist, we get the red X. I want to display something other
than
> > the
> > > red X.
> > >
> > > Any ideas?
> > >
> > > Thanks,
> > > Jim
> > >
> > >
> >
> >
>