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

Wednesday, March 28, 2012

How Can I recover master database from master's backup?

I did a new instalation, and I want to recover master
database from master's backup, but the system show me the
next message RESTORE DATABASE must be in single user mode
when trying to restore the master database.
It's very important to me get information about the
aplication's users but I can't do that.
The system don't permit to put in single user mode to
master then I don't no what to do for resolving this.
Somebody Help me ?
Thanks LorenaSee my other post. No need to re-post.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Lorena" <anonymous@.discussions.microsoft.com> wrote in message
news:bba401c40dea$4e4130a0$a001280a@.phx.gbl...
> I did a new instalation, and I want to recover master
> database from master's backup, but the system show me the
> next message RESTORE DATABASE must be in single user mode
> when trying to restore the master database.
> It's very important to me get information about the
> aplication's users but I can't do that.
> The system don't permit to put in single user mode to
> master then I don't no what to do for resolving this.
> Somebody Help me ?
> Thanks Lorena
>sql

Monday, March 26, 2012

How can I programmatically know if RS is installed on a server or not

Hi,,
I have a list of SQL servers available in our network in a ComboBox ,I want
to show a message if there is no reporting service installed on a server of
user choice ,I tried to use listChildern ,,but when there is no RS ,,it
thows an Exception inside the web referenc.
ThanksOne suggestion would be to put the code calling ListChildren inside of
a Try Catch block. If you catch the exception you can display a
message box saying reporting services was not found.
More info on Try Catch can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingtrycatchblocktocatchexceptions.asp
The problem with this approach is you'll have to set the Url property
of the web reference and assume the report server is installed at the
default location (http://machinename/reportserver). If someone
installed the report server at a different location you'll need a more
robust mechanism to find it. I'd suggest trying WMI (windows
management instrumentation). There is an example in the docs showing
how to connect to a remote report server:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_wmi_6iua.asp
Note: the sample code in the docs also needs a try / catch in case the
server does not have SSRS installed.
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Fri, 12 Nov 2004 11:25:32 -0800, "ALI-R" <newbie@.microsoft.com>
wrote:
>Hi,,
>I have a list of SQL servers available in our network in a ComboBox ,I want
>to show a message if there is no reporting service installed on a server of
>user choice ,I tried to use listChildern ,,but when there is no RS ,,it
>thows an Exception inside the web referenc.
>Thanks
>

Wednesday, March 21, 2012

how can I obtain message_id?

Hi all!

How can I obtain message_id when I SEND the message, before I execute RECEIVE statement?

Thanks a lot for the help!

Are you sending to a service and then wanting to recieve from it straight after in the same code?
What are you trying to achieve with this code?

|||

Hi, SimonS_! Thank you for fast response.

I'm send the message in one procedure:

create procedure [dbo].[proc_Client]

as

begin

set nocount on;

declare @.conversation_handle uniqueidentifier

begin dialog conversation @.conversation_handle

FROM SERVICE [My Service1]

TO SERVICE [My Service2]

ON CONTRACT [Custom Comtract]

send on conversation @.conversation_handle message type [//Messaging/CustomMsg]('message data');

and here I want to save the Service Broker message_ID in the my table

end conversation @.conversation_handle;

end

Then I have an Activation Procedure:

CREATE Procedure [proc_ms_Activation]

AS

BEGIN

SET NOCOUNT ON

WAITFOR (RECEIVE TOP(1) @.internal_SB_message_id = message_id, @.message_type_name = message_type_name, @.message_body = message_body, @.conversation_handle = conversation_handle FROM Queue1);

END

mesage_id I receive only in [proc_ms_Activation], but I need save this message_id in [proc_Client] procedure. Could you please help me?

|||

I still don't know why you need the message Id.

Are you trying to manage state ?

|||Yes, I'm try to manage message state, keep messages in database and found it, and I have additional logic - gathering statistics, track poison messages and etc|||

Two points,

Messages that come back to your initiator service use the same conversation group. This means that if you specify a conversation group you can use that to correlate messages you send to messages you receive.

In this situation generate a guid (newid()) and then use that for the conversation_group_id. Then you can store it in a table, If you want the target service to know this id then you will need to include it in the message.

|||

We didn't see a need to expose message_ids at the system level since apps that require tracking state at a per-message level would have primitives within the app itself for doing so. You could for example stick some cookie into the message sent by the initiator and relay it back with the response so that your app can corelate the response to the request. Depending on the app this may be a 'request ID', an 'order number', a 'service request ticket', etc.

Rushi

|||

The other way to refactor the app would be to think of a conversation as being the primitive for identifying a request. So each request would be sent on its own unique conversation. That way the app can store state with the conversation itself (and you could use conversation_handle or conversation_group_id* as the primary key in that case). Responses for a particular request would only come back on the same conversation and hence you can easily correlate them. In fact we provide locking at the conversation level to prevent multiple queue readers from accessing the same conversation at the same time.

Rushi

*: You WILL need to use conversation_groups if you want to relate multiple conversations together. Even if today you don't do that, conversation_group_id is a better way to key state than handles.

|||

Rushi, thanks a lot for the detailed explanation.

The best decision for me will use one-message-per-dialog conversation and send one message per conversation, then trace application logic on conversation_id.

Thank you,

Sveta.

|||You don't have to have one message per dialog for this to work. I would say you want 1 Dialog per business transaction, that way any responses to any messages are on the same conversation group. You might want to send two messages rather than having to combine data from different sources in one message

Monday, February 27, 2012

How can I get the message return?

For some reasons I want to get the massage of return when I carry out a query.
I only know use @.@.error:
select * from teste; --teste does't exist
select description from master.dbo.sysmessages where error = @.@.error
Invalid object name '%.*ls'.
But I hope to get the massage:
Invalid object name 'teste'.
thanks!
Hi
What is you SQL Server's version?
if you are using SQL Server 2005 try
BEGIN TRY
INSERT INTO Employees(empid, empname, mgrid)
VALUES(1, 'Emp1', NULL)
PRINT 'After INSERT.'
END TRY
BEGIN CATCH
PRINT 'INSERT failed.'
/* perform corrective activity */
END CATCH
In SQL Server 2000
IF OBJECT_ID('teste ') IS NULL
PRINT 'Invalid object name teste'
"luyan" <luyan@.discussions.microsoft.com> wrote in message
news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
> For some reasons I want to get the massage of return when I carry out a
> query.
> I only know use @.@.error:
> select * from teste; --teste does't exist
> select description from master.dbo.sysmessages where error = @.@.error
> Invalid object name '%.*ls'.
> But I hope to get the massage:
> Invalid object name 'teste'.
> thanks!
|||Therefore you have to use a substitute parameter within the message.
Best thing would be NOT to use SELECT thing, better use the RAISERROR
statement:
USE MASTER
EXEC sp_addmessage
@.msgnum = 60003,
@.severity = 16,
@.msgtext =
N'Something happened on the way to %s'
RAISERROR(60001,1,1,'heaven')
GO
HTH, Jens Suessmeyer.
|||Sorry wrong RAISERROR according to the exmaples above:
RAISERROR(60003,1,1,'heaven')
|||In 2000, you can't. (Well you can use DBCC OUPUTBUFFER, which is a mess, suggested here a coupe of
days ago. Check the archives.)
In 2005, you can use the new ERROR_MESSAGE() function
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"luyan" <luyan@.discussions.microsoft.com> wrote in message
news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
> For some reasons I want to get the massage of return when I carry out a query.
> I only know use @.@.error:
> select * from teste; --teste does't exist
> select description from master.dbo.sysmessages where error = @.@.error
> Invalid object name '%.*ls'.
> But I hope to get the massage:
> Invalid object name 'teste'.
> thanks!
|||Thanks a lot!!
"Tibor Karaszi" wrote:

> In 2000, you can't. (Well you can use DBCC OUPUTBUFFER, which is a mess, suggested here a coupe of
> days ago. Check the archives.)
> In 2005, you can use the new ERROR_MESSAGE() function
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "luyan" <luyan@.discussions.microsoft.com> wrote in message
> news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
>

How can I get the message return?

For some reasons I want to get the massage of return when I carry out a quer
y.
I only know use @.@.error:
select * from teste; --teste does't exist
select description from master.dbo.sysmessages where error = @.@.error
Invalid object name '%.*ls'.
But I hope to get the massage:
Invalid object name 'teste'.
thanks!Hi
What is you SQL Server's version?
if you are using SQL Server 2005 try
BEGIN TRY
INSERT INTO Employees(empid, empname, mgrid)
VALUES(1, 'Emp1', NULL)
PRINT 'After INSERT.'
END TRY
BEGIN CATCH
PRINT 'INSERT failed.'
/* perform corrective activity */
END CATCH
In SQL Server 2000
IF OBJECT_ID('teste ') IS NULL
PRINT 'Invalid object name teste'
"luyan" <luyan@.discussions.microsoft.com> wrote in message
news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
> For some reasons I want to get the massage of return when I carry out a
> query.
> I only know use @.@.error:
> select * from teste; --teste does't exist
> select description from master.dbo.sysmessages where error = @.@.error
> Invalid object name '%.*ls'.
> But I hope to get the massage:
> Invalid object name 'teste'.
> thanks!|||Therefore you have to use a substitute parameter within the message.
Best thing would be NOT to use SELECT thing, better use the RAISERROR
statement:
USE MASTER
EXEC sp_addmessage
@.msgnum = 60003,
@.severity = 16,
@.msgtext =
N'Something happened on the way to %s'
RAISERROR(60001,1,1,'heaven')
GO
HTH, Jens Suessmeyer.|||Sorry wrong RAISERROR according to the exmaples above:
RAISERROR(60003,1,1,'heaven')|||In 2000, you can't. (Well you can use DBCC OUPUTBUFFER, which is a mess, sug
gested here a coupe of
days ago. Check the archives.)
In 2005, you can use the new ERROR_MESSAGE() function
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"luyan" <luyan@.discussions.microsoft.com> wrote in message
news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
> For some reasons I want to get the massage of return when I carry out a qu
ery.
> I only know use @.@.error:
> select * from teste; --teste does't exist
> select description from master.dbo.sysmessages where error = @.@.error
> Invalid object name '%.*ls'.
> But I hope to get the massage:
> Invalid object name 'teste'.
> thanks!|||Thanks a lot!!
"Tibor Karaszi" wrote:

> In 2000, you can't. (Well you can use DBCC OUPUTBUFFER, which is a mess, s
uggested here a coupe of
> days ago. Check the archives.)
> In 2005, you can use the new ERROR_MESSAGE() function
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "luyan" <luyan@.discussions.microsoft.com> wrote in message
> news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
>

How can I get the message return?

For some reasons I want to get the massage of return when I carry out a query.
I only know use @.@.error:
select * from teste; --teste does't exist
select description from master.dbo.sysmessages where error = @.@.error
Invalid object name '%.*ls'.
But I hope to get the massage:
Invalid object name 'teste'.
thanks!Hi
What is you SQL Server's version?
if you are using SQL Server 2005 try
BEGIN TRY
INSERT INTO Employees(empid, empname, mgrid)
VALUES(1, 'Emp1', NULL)
PRINT 'After INSERT.'
END TRY
BEGIN CATCH
PRINT 'INSERT failed.'
/* perform corrective activity */
END CATCH
In SQL Server 2000
IF OBJECT_ID('teste ') IS NULL
PRINT 'Invalid object name teste'
"luyan" <luyan@.discussions.microsoft.com> wrote in message
news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
> For some reasons I want to get the massage of return when I carry out a
> query.
> I only know use @.@.error:
> select * from teste; --teste does't exist
> select description from master.dbo.sysmessages where error = @.@.error
> Invalid object name '%.*ls'.
> But I hope to get the massage:
> Invalid object name 'teste'.
> thanks!|||Therefore you have to use a substitute parameter within the message.
Best thing would be NOT to use SELECT thing, better use the RAISERROR
statement:
USE MASTER
EXEC sp_addmessage
@.msgnum = 60003,
@.severity = 16,
@.msgtext = N'Something happened on the way to %s'
RAISERROR(60001,1,1,'heaven')
GO
HTH, Jens Suessmeyer.|||Sorry wrong RAISERROR according to the exmaples above:
RAISERROR(60003,1,1,'heaven')|||In 2000, you can't. (Well you can use DBCC OUPUTBUFFER, which is a mess, suggested here a coupe of
days ago. Check the archives.)
In 2005, you can use the new ERROR_MESSAGE() function
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"luyan" <luyan@.discussions.microsoft.com> wrote in message
news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
> For some reasons I want to get the massage of return when I carry out a query.
> I only know use @.@.error:
> select * from teste; --teste does't exist
> select description from master.dbo.sysmessages where error = @.@.error
> Invalid object name '%.*ls'.
> But I hope to get the massage:
> Invalid object name 'teste'.
> thanks!|||Thanks a lot!!
"Tibor Karaszi" wrote:
> In 2000, you can't. (Well you can use DBCC OUPUTBUFFER, which is a mess, suggested here a coupe of
> days ago. Check the archives.)
> In 2005, you can use the new ERROR_MESSAGE() function
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "luyan" <luyan@.discussions.microsoft.com> wrote in message
> news:6CAC52A9-FC79-4C22-9053-CC7F3424E991@.microsoft.com...
> > For some reasons I want to get the massage of return when I carry out a query.
> > I only know use @.@.error:
> > select * from teste; --teste does't exist
> > select description from master.dbo.sysmessages where error = @.@.error
> > Invalid object name '%.*ls'.
> > But I hope to get the massage:
> > Invalid object name 'teste'.
> >
> > thanks!
>

Friday, February 24, 2012

how can I get the error message?

I want to insert csv file into table.

In Control Flow Tab I insert a Data Flow Task and a Script Task

The Script Task is under the Data Flow Task as the failure handle to generate Log.

but I don't konw how to get the Data Flow Task's error message in Script Task?

thank you for you answer!!

Try moving the script task into an OnError eventhandler. The error message is available in there.

Let me know if this creates a problem.

-Jamie

|||

thank you for the answer.

I moved the script task to event handler tag. but it didn't run though my deta flow task generated a primary key error.

also I would like to know wether it is the err.description from that property I can konw the error message?