Showing posts with label working. Show all posts
Showing posts with label working. Show all posts

Thursday, March 22, 2012

((cdate("1/1/2001")+30) as task_due_date (Not working)

I have the below function written in VB, and everything works fine
EXCEPT that the sql code is not executing correctly. The date field is
in the table always shows "12/1/1899 11:59:17 PM" no other date. I'm
should have the date of the input into the function + or - the integer
in the task_due_days field.

for example (cdate("1/1/2002")+30) as task_due_date

What am I doing wrong?

Function SetTasks(trans_id As Long, trans_type As Integer, event_date
As Date)

Dim task As String

task = "Insert into tbl_tasks
(trans_id,task_name,Task_due_date,comments) SELECT (" & trans_id & ")
as trans_id,task_name,(cdate(" & event_date & ")+[task_due_days]) as
task_due_date,comments FROM tbl_task_parameter WHERE trans_type=" &
trans_type

Debug.Print task

DoCmd.RunSQL (task)

End Function

the actual SQL code is....

Insert into tbl_tasks (trans_id,task_name,Task_due_date,comments)
SELECT (192) as trans_id,task_name,(cdate(1/1/2001)+[task_due_days]) as
task_due_date,comments FROM tbl_task_parameter WHERE trans_type=1

ANY HELP IS GREATLY APPRECIATED!(stoppal@.hotmail.com) writes:
> the actual SQL code is....
> Insert into tbl_tasks (trans_id,task_name,Task_due_date,comments)
> SELECT (192) as trans_id,task_name,(cdate(1/1/2001)+[task_due_days]) as
> task_due_date,comments FROM tbl_task_parameter WHERE trans_type=1

Apparently you are not using SQL Server, as there is no cdate function
in SQL Serever.

I can tell what the problem is though: 1/1/2001 = 0 with integer division,
and with floating-point division you get 0.0005. Since you got
11:59:17, I guess that in whatever you are using, you have floating-
point division. (In SQL Server you would get integer division here.)

So you need to delimit the date string. In SQL Server that would be
'1/1/2001'. But it looks a bit likely you are using Access, in which
case maybe ## is better. But you better ask in comp.databases.ms-access
it you are uncertain.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.aspsql

&rs:Parameters=false not working if redering reports in a iframe;

Hi,
I have problem with &rs:Parameters=false it's not working if reports in a
iframe;
same url working well on a normal page; any trick? here is my url:
http://localhost/ReportServer?/BASE/Opened Incidents By Severity - Chart and
Graph&rs%3aCommand=Render&rs%3aformat=HTML4.0&rc%3aParameters=false&date1=2006-05-01&date2=2006-05-02&unit_id=-1147471730&children=Y
thanks in advance! /Tomsorry, my bad, I mess up with rc: and rs in iframe url: everything is OK now,
thanks!
"TomKang2000" wrote:
> Hi,
> I have problem with &rs:Parameters=false it's not working if reports in a
> iframe;
> same url working well on a normal page; any trick? here is my url:
> http://localhost/ReportServer?/BASE/Opened Incidents By Severity - Chart and
> Graph&rs%3aCommand=Render&rs%3aformat=HTML4.0&rc%3aParameters=false&date1=2006-05-01&date2=2006-05-02&unit_id=-1147471730&children=Y
> thanks in advance! /Tom

Sunday, March 11, 2012

"Open Table" NOT WORKING. Can someone HELP!

In my instance of "sql server 2005" I right click on a table and select "Open Table" then I get the error message "Object reference not set to..." Then has been happening since I installed I have tryed searching groups and posting to get a solution. I have load the adventure works data base and get the same error when performing "open table". Can someone from MS please respond. Also if Open Table works can you edit the data directly in the results pane?

I had very similar problem. The problem was gone after I installed SP2.|||

Have you tried to attempt from another client's machine against this server?

Also test and try using SP2 on SQL 2005, if it is not a SQL 2005 instance then make sure to have latest service pack on SQL 2000 too.

|||

I am sorry but I should have been more specific about what happened in my case. Here is the story:

The instance of SQL 2005 is on machine A and I had no problem in accessing the tables from machine A. The problem was with machine B on which I was running Management Studio to access the SQL server on machine A. I could connect, open the database, display columns of the tables, but whenever I tried to open a table to browse data or modify the table, I got the error. I installed SQL 2005 SP2 on machine B and the problem was gone. Apparently something was wrong with the instance of Management Studio on machine B. It worked fine flawlessly for a very long time. I have no clue what caused the problem for SSMS.

"Open Table" NOT WORKING. Can someone HELP!

In my instance of "sql server 2005" I right click on a table and select "Open Table" then I get the error message "Object reference not set to..." Then has been happening since I installed I have tryed searching groups and posting to get a solution. I have load the adventure works data base and get the same error when performing "open table". Can someone from MS please respond. Also if Open Table works can you edit the data directly in the results pane?

I had very similar problem. The problem was gone after I installed SP2.|||

Have you tried to attempt from another client's machine against this server?

Also test and try using SP2 on SQL 2005, if it is not a SQL 2005 instance then make sure to have latest service pack on SQL 2000 too.

|||

I am sorry but I should have been more specific about what happened in my case. Here is the story:

The instance of SQL 2005 is on machine A and I had no problem in accessing the tables from machine A. The problem was with machine B on which I was running Management Studio to access the SQL server on machine A. I could connect, open the database, display columns of the tables, but whenever I tried to open a table to browse data or modify the table, I got the error. I installed SQL 2005 SP2 on machine B and the problem was gone. Apparently something was wrong with the instance of Management Studio on machine B. It worked fine flawlessly for a very long time. I have no clue what caused the problem for SSMS.

"Open Table" NOT WORKING. Can someone HELP!

In my instance of "sql server 2005" I right click on a table and select "Open Table" then I get the error message "Object reference not set to..." Then has been happening since I installed I have tryed searching groups and posting to get a solution. I have load the adventure works data base and get the same error when performing "open table". Can someone from MS please respond. Also if Open Table works can you edit the data directly in the results pane?

I had very similar problem. The problem was gone after I installed SP2.|||

Have you tried to attempt from another client's machine against this server?

Also test and try using SP2 on SQL 2005, if it is not a SQL 2005 instance then make sure to have latest service pack on SQL 2000 too.

|||

I am sorry but I should have been more specific about what happened in my case. Here is the story:

The instance of SQL 2005 is on machine A and I had no problem in accessing the tables from machine A. The problem was with machine B on which I was running Management Studio to access the SQL server on machine A. I could connect, open the database, display columns of the tables, but whenever I tried to open a table to browse data or modify the table, I got the error. I installed SQL 2005 SP2 on machine B and the problem was gone. Apparently something was wrong with the instance of Management Studio on machine B. It worked fine flawlessly for a very long time. I have no clue what caused the problem for SSMS.

"Open Table" NOT WORKING in Management Studio

When I open a database and right click and select "Open Table" I get the error message "Object reference not set to...". What could the issue be. I have loaded the adventure works db and tried it also and still get the same error. Could someone at MS please respond to this. Also when open table works can I directly edit values in the result pane like I did in Sql Server 2000?

This forum is for Analysis Services -related questions. Try posting on "SQL Server Tools General" forum.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Open Table" NOT WORKING in Management Studio

When I open a database and right click and select "Open Table" I get the error message "Object reference not set to...". What could the issue be. I have loaded the adventure works db and tried it also and still get the same error. Could someone at MS please respond to this. Also when open table works can I directly edit values in the result pane like I did in Sql Server 2000?

This forum is for Analysis Services -related questions. Try posting on "SQL Server Tools General" forum.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Open Table" NOT WORKING in Management Studio

When I open a database and right click and select "Open Table" I get the error message "Object reference not set to...". What could the issue be. I have loaded the adventure works db and tried it also and still get the same error. Could someone at MS please respond to this. Also when open table works can I directly edit values in the result pane like I did in Sql Server 2000?

David,

I will do some research on "Object reference not set to" error. You can edit data directly from the results pane.

Thanks!

|||

David,

We need more information about this error. Are you still able to reproduce this error?

Thanks!

|||

I have never been able to explain why it happened. When I would try to do "open table" I would always get the "object ref not set" error. I did uninstall and when I re-installed the install locked up on "Setting File Security". I had seen that error before and knew to unplug the network connection. After I reinstalled the error went away.

I wanted to know if we can get behahivior similiar to 2000 where a user could enter a sql select and then edit the results in results pane. The open table helps but when you want to quickly change a value the edit of a few rows is easier than finding a row in a large result set. Also I noticed when I unistalled I had to uninstall each component separately. Can the uninstall of sql server 2005 uninstall all components.

thanks

|||

Sounds like "object ref not set" error might have been due to corrupted installation. Please let us know if you encounter that error again.

Current SQL Editor does not allow you to edit directly from the results grid as you've noticed. You can choose Open Table and bring up SQL Pane from the Query Designer by either clicking on a toolbar icon (a whitebox with SQL text in it) or hitting CTRL+3. Then edit the SQL syntax to bring up a sub-set of records for editing.

For uninstallation issue, please provide your feedback through http://lab.msdn.microsoft.com/productfeedback/Default.aspx. All feedbacks received via our Product Feedback center are reviewed by the team and we treat them seriously.

Hope this helps.

Thanks!

|||

Can you give us the logic behind why you can't edit the result set of a query?!?!

I am, frankly, astonished that this feature was removed. It is truly one of the most useful features for a quick edit of data.

On that note, the workaround is that you "open the table"? Am I missing something that doing an "open table" produces all data in the table? So, we have to burden the machine with potentially thousands upon thousands of records just to edit a single field? Crazy!

Also, using a join query after "opening" the table results in read only!

The other way around is to find the right record ID, then write an update query?

Seriously, is there any explanation because it sounds completely ludicrous to me? What was the point of this?

/sorry to seem so annoyed, but so many people rely on this feature. I know I'm not the only one.

"Open Table" NOT WORKING in Management Studio

When I open a database and right click and select "Open Table" I get the error message "Object reference not set to...". What could the issue be. I have loaded the adventure works db and tried it also and still get the same error. Could someone at MS please respond to this. Also when open table works can I directly edit values in the result pane like I did in Sql Server 2000?

David,

I will do some research on "Object reference not set to" error. You can edit data directly from the results pane.

Thanks!

|||

David,

We need more information about this error. Are you still able to reproduce this error?

Thanks!

|||

I have never been able to explain why it happened. When I would try to do "open table" I would always get the "object ref not set" error. I did uninstall and when I re-installed the install locked up on "Setting File Security". I had seen that error before and knew to unplug the network connection. After I reinstalled the error went away.

I wanted to know if we can get behahivior similiar to 2000 where a user could enter a sql select and then edit the results in results pane. The open table helps but when you want to quickly change a value the edit of a few rows is easier than finding a row in a large result set. Also I noticed when I unistalled I had to uninstall each component separately. Can the uninstall of sql server 2005 uninstall all components.

thanks

|||

Sounds like "object ref not set" error might have been due to corrupted installation. Please let us know if you encounter that error again.

Current SQL Editor does not allow you to edit directly from the results grid as you've noticed. You can choose Open Table and bring up SQL Pane from the Query Designer by either clicking on a toolbar icon (a whitebox with SQL text in it) or hitting CTRL+3. Then edit the SQL syntax to bring up a sub-set of records for editing.

For uninstallation issue, please provide your feedback through http://lab.msdn.microsoft.com/productfeedback/Default.aspx. All feedbacks received via our Product Feedback center are reviewed by the team and we treat them seriously.

Hope this helps.

Thanks!

|||

Can you give us the logic behind why you can't edit the result set of a query?!?!

I am, frankly, astonished that this feature was removed. It is truly one of the most useful features for a quick edit of data.

On that note, the workaround is that you "open the table"? Am I missing something that doing an "open table" produces all data in the table? So, we have to burden the machine with potentially thousands upon thousands of records just to edit a single field? Crazy!

Also, using a join query after "opening" the table results in read only!

The other way around is to find the right record ID, then write an update query?

Seriously, is there any explanation because it sounds completely ludicrous to me? What was the point of this?

/sorry to seem so annoyed, but so many people rely on this feature. I know I'm not the only one.

"Open Table" NOT WORKING in Management Studio

When I open a database and right click and select "Open Table" I get the error message "Object reference not set to...". What could the issue be. I have loaded the adventure works db and tried it also and still get the same error. Could someone at MS please respond to this. Also when open table works can I directly edit values in the result pane like I did in Sql Server 2000?

David,

I will do some research on "Object reference not set to" error. You can edit data directly from the results pane.

Thanks!

|||

David,

We need more information about this error. Are you still able to reproduce this error?

Thanks!

|||

I have never been able to explain why it happened. When I would try to do "open table" I would always get the "object ref not set" error. I did uninstall and when I re-installed the install locked up on "Setting File Security". I had seen that error before and knew to unplug the network connection. After I reinstalled the error went away.

I wanted to know if we can get behahivior similiar to 2000 where a user could enter a sql select and then edit the results in results pane. The open table helps but when you want to quickly change a value the edit of a few rows is easier than finding a row in a large result set. Also I noticed when I unistalled I had to uninstall each component separately. Can the uninstall of sql server 2005 uninstall all components.

thanks

|||

Sounds like "object ref not set" error might have been due to corrupted installation. Please let us know if you encounter that error again.

Current SQL Editor does not allow you to edit directly from the results grid as you've noticed. You can choose Open Table and bring up SQL Pane from the Query Designer by either clicking on a toolbar icon (a whitebox with SQL text in it) or hitting CTRL+3. Then edit the SQL syntax to bring up a sub-set of records for editing.

For uninstallation issue, please provide your feedback through http://lab.msdn.microsoft.com/productfeedback/Default.aspx. All feedbacks received via our Product Feedback center are reviewed by the team and we treat them seriously.

Hope this helps.

Thanks!

|||

Can you give us the logic behind why you can't edit the result set of a query?!?!

I am, frankly, astonished that this feature was removed. It is truly one of the most useful features for a quick edit of data.

On that note, the workaround is that you "open the table"? Am I missing something that doing an "open table" produces all data in the table? So, we have to burden the machine with potentially thousands upon thousands of records just to edit a single field? Crazy!

Also, using a join query after "opening" the table results in read only!

The other way around is to find the right record ID, then write an update query?

Seriously, is there any explanation because it sounds completely ludicrous to me? What was the point of this?

/sorry to seem so annoyed, but so many people rely on this feature. I know I'm not the only one.

"One or more DataSources is missing credentials"

Get this when selecting parameter value in Report Manager

Report is working fine in preview

Up to me, it has nothing to do with credentials

I have some analysis server reports.

I have a single value report parameter, the report runs fine with the default value, when I select another value than the default one, I get above message immediately.

I got the error since I rebuild the report with SP2 CTP.

Strange thing is that the other single value parameter of the report works fine (year)

And that I get the error also with other reports, and on the same dimension (Organisation)

And that I do not have the error when I change the parameter to multi-value (but as the report is not written for multiple values...)

MDX queries are as follows:

SELECT NON EMPTY { KPIValue("KPINewBiz"), KPIGoal("KPINewBiz"), KPIStatus("KPINewBiz"), KPITrend("KPINewBiz") } ON COLUMNS,

NONEMPTY

([Reps].[Organisation].[Organisation].ALLMEMBERS

*[Reps].[Rep].[Rep].ALLMEMBERS

*[Date].[Year].[Year].ALLMEMBERS

*[Date].[Month].[Month].ALLMEMBERS

,[Measures].[Gross Sales]

)

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS

FROM ( SELECT ( STRTOSET(@.ByYear, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@.ByOrganisation, CONSTRAINED) ) ON COLUMNS FROM [Sales])) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

WITH MEMBER [Measures].[ParameterCaption] AS '[Reps].[Organisation].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Reps].[Organisation].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Reps].[Organisation].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,

NONEMPTY([Reps].[Organisation].[Organisation].ALLMEMBERS,[Measures].[Gross Sales]) ON ROWS FROM [Sales]

WITH MEMBER [Measures].[ParameterCaption] AS '[Date].[Year].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Date].[Year].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Date].[Year].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , NONEMPTY([Date].[Year].[Year].ALLMEMBERS,[Measures].[Gross Sales]) ON ROWS FROM [Sales]

Discovered something else that is very strange, you change the value of the parameter, you get the error, you hit the back button, and you can run the report with the new parameter

Did one more test, changed the order of the parameters, is now going wrong on the other parameter, Year.

So, it is always on the first parameter.

Correction, I have put a multi-value parameter as first, I still have the problem, it is always on the first single value parameter


I have the same problem.

Up to me, it has nothing to do with credentials

I have some analysis server reports.

I have a single value report parameter, the report runs fine with the default value, when I select another value than the default one, I get above message immediately.

I got the error since I rebuild the report with SP2 CTP.

Strange thing is that the other single value parameter of the report works fine (year)

And that I get the error also with other reports, and on the same dimension (Organisation)

And that I do not have the error when I change the parameter to multi-value (but as the report is not written for multiple values...)

MDX queries are as follows:

SELECT NON EMPTY { KPIValue("KPINewBiz"), KPIGoal("KPINewBiz"), KPIStatus("KPINewBiz"), KPITrend("KPINewBiz") } ON COLUMNS,

NONEMPTY

([Reps].[Organisation].[Organisation].ALLMEMBERS

*[Reps].[Rep].[Rep].ALLMEMBERS

*[Date].[Year].[Year].ALLMEMBERS

*[Date].[Month].[Month].ALLMEMBERS

,[Measures].[Gross Sales]

)

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS

FROM ( SELECT ( STRTOSET(@.ByYear, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@.ByOrganisation, CONSTRAINED) ) ON COLUMNS FROM [Sales])) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

WITH MEMBER [Measures].[ParameterCaption] AS '[Reps].[Organisation].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Reps].[Organisation].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Reps].[Organisation].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,

NONEMPTY([Reps].[Organisation].[Organisation].ALLMEMBERS,[Measures].[Gross Sales]) ON ROWS FROM [Sales]

WITH MEMBER [Measures].[ParameterCaption] AS '[Date].[Year].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Date].[Year].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Date].[Year].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , NONEMPTY([Date].[Year].[Year].ALLMEMBERS,[Measures].[Gross Sales]) ON ROWS FROM [Sales]

Discovered something else that is very strange, you change the value of the parameter, you get the error, you hit the back button, and you can run the report with the new parameter


Microsoft released a December update to the CTP yesterday. The update fixes the problem.

http://www.microsoft.com/downloads/details.aspx?FamilyId=D2DA6579-D49C-4B25-8F8A-79D14145500D&displaylang=en

|||thanks

Thursday, March 8, 2012

"login failed for user" message when executing a copy of a working package

I notice when I copy an SSIS package 'A' to a new package 'B', the new package 'B' will generate a "login failed for user" message in the data flow components. To copy I "save copy of Package 'A' as."

Some config info:

    Package ProtectionLevel = EncryptSensitiveWithPassword

    Connections are Data Sources

    Connection strings with password are stored using PackageConfigurations to an SQLServer table. I've verified Package 'A' is in fact using the config table (e.g. it is not using a password or user stored in the package)

    Data connectios are all SQLServer Native OLE DB Client

    The account is an SQLServer account (not integrated security)

The original Package 'A' works flawlessly and I get success when I test the connections in Package 'B'.

But executing package 'B' I get: The error message I get is: [Connection manager "MyConnection"] Error: An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E4D Description: "Login failed for user 'dwuser'.".

Does anyone know why this would occur and/or how to work around it? I saw another thread where a potential workaround is to create a new data flow task and copy all the data flow components to that task. That won't work well for us because the data flow is moderately complex and when you copy and paste it, SSIS completely re-orders the layout.

This is a typical data warehouse ETL setup where there is a master package that executes child packages (e.g. 'A', and 'B' mentioned above) that each perform the ETL for a specific dimension or fact table.

Thanks for any help,

Lee Cascio

Some more info and revelation.

Both child packages will run fine if I execute them independently (outside the parent package that calls them). The problem seems to occur when I try to execute them from a parent package. The OLE Db Connections will then fail on validation on both packages with the "login failed" message listed above in addition to the following: [MyTable [1]] Error: The AcquireConnection method call to the connection manager "MyDataSourceConnection" failed with error code 0xC0202009.

An interesting observation is if I disable Package 'B' in the parent package, Package 'A' will execute without flaw with the parent package. If I disable Package 'A' and enable Package 'B', Package 'B' will still have the problem. Another note, the parent package also uses the data source connections.

It appears we have some kind of problem with multiple packages using the same data source. Does anyone know if there are any limitations to this or if it requires special transaction settings?

Thanks,

Lee Cascio

|||I resolved this issue by switching to XML configurations instead of SQL Server table configurations. I'm still not sure of the exact cause but would have been a problem with credentials getting to the SQL Server Table for the configurations (which include connection strings).

Thursday, February 16, 2012

<DeviceInfo> <DpiX> not working with pdf (sql 2005)

Hello,
I'm trying to set dpi of output pdf using DpiX and DpiY but they seem
to not work.
I call SQL 2005 Reporting Services through web services.
I call the method Render with devInfo = "<DeviceInfo><DpiX>600</DpiX><DpiY>600</DpiY></DeviceInfo>".
Ideas? Thank you.
FabrizioHave you figured this out yet? I am having the same problem.
Thanks!
"fhtino" wrote:
> Hello,
> I'm trying to set dpi of output pdf using DpiX and DpiY but they seem
> to not work.
> I call SQL 2005 Reporting Services through web services.
> I call the method Render with devInfo => "<DeviceInfo><DpiX>600</DpiX><DpiY>600</DpiY></DeviceInfo>".
>
> Ideas? Thank you.
>
> Fabrizio
>|||It looks like this option may have gone away with SQL 2005!
Compare these two pages
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_prog_soapapi_dev_8bld.asp
http://msdn2.microsoft.com/en-us/library/ms154682(SQL.90).aspx
Can this be true?|||I have found no solution. DpiX and DpiY seem to be not available in
sql2005.
I think it's could be very usefull a response from MS... is there
anyone from MS?
Fabrizio
shelley wrote:
> Have you figured this out yet? I am having the same problem.
> Thanks!

<Code>-8462</Code>

Hi:

My service broker is working with 2 different instances in local server.But could not able to get working on 2 different servers because of Conversation ID cannot be associated with an active conversation error which I have posted.

After I receive the message successfully...in the end I get this message sent...

<Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error">

<Code>-8462</Code>

<Description>The remote conversation endpoint is either in a state where no more messages can be exchanged, or it has been dropped.</Description>

</Error>

Why am i gettting this error after the conversation.

Thanks,

Pramod

Pramod

You have not shared enough information for us to be able to help you. There are legitimate reasons why you might receive this error. If in fact, the remote conversation endpoint has been dropped and the local service sends another message on this same conversation, you should get this. Another less obvious way to get a message of this nature would be if the remote database was restored to an earlier time prior to the existence of the conversation being used.

For us to help you debug why you are getting this message, you will need to share more about your specific usage. It would also be interesting to know if the two services that are communicating on the conversation are taking turns in a half-duplex fashion (one side, then the other, but never simultaneously) or if both are sending to each other potentially at the same time (full-duplex).

|||

Gerald:

I have 3 stored procedures. Initiator will have 2 procedures one to send message and receive acknowledgement.

Target will have 1 stored procedure to receive and send acknowledgement.

Initiator Sproc:
-
SP 1:
ALTER PROCEDURE [dbo].[usp_SendMessage]
@.userID int AS
BEGIN
DECLARE @.dialog_handle uniqueidentifier,
@.msg XML

BEGIN DIALOG CONVERSATION @.dialog_handle FROM SERVICE CLIENTSERVICE

TO SERVICE 'SERVERSERVICE' ON CONTRACT MainContract WITH ENCRYPTION = OFF ;

SET @.msg =(select queue.userid,queue.Friendlyname,queue.TemplateName,filters.columnkey,filters.datatype,
criteria.leftarg,criteria.logop,criteria.rightarg, fields.field, fields.datatype, fields.grouporder, fields.summed, fields.averaged, fields.counted from queue LEFT OUTER JOIN filters on queue.id=filters.reportid LEFT OUTER JOIN criteria on filters.id = criteria.filterid LEFT OUTER JOIN fields on queue.id =fields.reportid where queue.id=@.userID FOR XML AUTO);

-- Now Sending a message note we are using
-- SendMessageType since it is defined in the contract
-- that it is to be sent only by initiater

SEND ON CONVERSATION @.dialog_handle MESSAGE TYPE SendMessageType (@.msg);

END

SP 2:
-
ALTER PROCEDURE [dbo].[usp_OnReceiveMessage] AS
declare @.message_type int
declare @.dialog uniqueidentifier,
@.ErrorSave INT,
@.ErrorDesc NVARCHAR(100),
@.message_body XML;

while (1 = 1)
begin
begin transaction -- Receive the next available message from the queue
WAITFOR (
RECEIVE top(1) -- just handle one message at a time
@.message_type=message_type_id, --the type of message received @.message_body=message_body, -- the message contents
@.dialog = conversation_handle -- the identifier of the dialog this message was received on
FROM CLIENTQUEUE ), TIMEOUT 30000 -- if the queue is empty for three second, give UPDATE and go away If we didn't get anything, bail out

if (@.@.ROWCOUNT = 0)
BEGIN
Rollback Transaction
BREAK
END

-- Check for errors in Receive
SET @.ErrorSave = @.@.ERROR ;
IF (@.ErrorSave <> 0)
BEGIN
ROLLBACK TRANSACTION ;
SET @.ErrorDesc = N'An error has occurred.' ;
END CONVERSATION @.dialog
WITH ERROR = @.ErrorSave DESCRIPTION = @.ErrorDesc ;
INSERT INTO messages_log VALUES(@.ErrorDesc,NULL) END
ELSE -- Check for the End Dialog message.
If (@.message_type <> 2) -- End dialog message

BEGIN-- Log Message in Database
INSERT INTO messages_log VALUES('Successfully Received:TEST',@.message_body);
-- Send the message back to the sender.

SET @.message_body = '<msg>Aknowledge message sent </msg>';
SEND ON CONVERSATION @.dialog -- send it back on the dialog we received the message on MESSAGE TYPE SendMessageType (@.message_body);
-- Must always supply a message type the message contents are XML

END CONVERSATION @.dialog WITH CLEANUP
END
ELSE
BEGIN-- End Conversation and Notify other side of the conversation

END CONVERSATION @.dialog WITH CLEANUP
END -- Commit the transaction. At any point before this, we could roll -- back - the received message would be back on the queue and the response -- wouldn't be sent.
commit transaction
end

-
TARGET SPROC:
-

ALTER PROCEDURE [dbo].[usp_OnReceiveMessage]

AS

declare @.message_type int

declare @.dialog uniqueidentifier,

@.ErrorSave INT,

@.ErrorDesc NVARCHAR(100),

@.message_body XML;

while (1 = 1)

begin

begin transaction

-- Receive the next available message from the queue

WAITFOR (

RECEIVE top(1) -- just handle one message at a time

@.message_type=message_type_id, --the type of message received

@.message_body=message_body, -- the message contents

@.dialog = conversation_handle -- the identifier of the dialog this message was received on

FROM SERVERQUEUE

), TIMEOUT 3000 -- if the queue is empty for three second, give UPDATE and go away

-- If we didn't get anything, bail out

if (@.@.ROWCOUNT = 0)

BEGIN

Rollback Transaction

BREAK

END

-- Check for errors in Receive

SET @.ErrorSave = @.@.ERROR ;

IF (@.ErrorSave <> 0)

BEGIN

ROLLBACK TRANSACTION ;

SET @.ErrorDesc = N'An error has occurred in client.' ;

END CONVERSATION @.dialog

WITH ERROR = @.ErrorSave DESCRIPTION = @.ErrorDesc ;

INSERT INTO messages_log VALUES(@.ErrorDesc,NULL)

END

ELSE

-- Check for the End Dialog message.

If (@.message_type <> 2) -- End dialog message

BEGIN

-- Log Message in Database

INSERT INTO messages_log VALUES('Successfully Received',@.message_body);

-- Send the message back to the sender.

SET @.message_body = '<msg>Sending the acknowledgement to client</msg>';

SEND ON CONVERSATION @.dialog -- send it back on the dialog we received the message on

MESSAGE TYPE ReceiveMessageType -- Must always supply a message type

(@.message_body); -- the message contents are XML

--END CONVERSATION @.dialog

END

ELSE

BEGIN

-- End Conversation and Notify other side of the conversation

END CONVERSATION @.dialog

END

-- Commit the transaction. At any point before this, we could roll

-- back - the received message would be back on the queue and the response

-- wouldn't be sent.

commit transaction

end

--

When I ran these with 2 different dbs in same instances...i get the acknowledge correctly. But when i using b/w 2 instances of db...I dont get the acknowledgement but the error code is there in target queue.


|||

You are using ENd DIALOG ... WITH CLEANUP. You should nevere do so. This explains all the problems you described so far in your posts. See this blog post too: http://blogs.msdn.com/remusrusanu/archive/2006/01/27/518455.aspx

HTH,
~ Remus

|||

I suspect that the "it works within an instance, but not across instances" is a classic race condition. In other words, by introducing more latency (ie. the network calls), the app runs with slightly different timing thereby allowing an existing bug to manifest itself. It probably isn't occurring when they are in the same instance because of optimizations our code base can take advantage of given its one instance. That doesn't mean it cannot happen there, just that it hasn't yet.

Having said that, I haven't had time to look at your code in depth, but one thing that is obviously wrong is your usage of END CONVERSATION WITH CLEANUP. END CONVERSATION WITH CLEANUP should not be used in application code as a rule. END CONVERSATION and END CONVERSATION WITH ERROR should be used in application code.

END CONVERSATION WITH CLEANUP is an administrative last resort to excise CONVERSATIONS and their undelivered messages from a database when there is no hope of delivery occurring. For example, the database containing the targetted remote service was dropped without properly ending conversations first.

So, for sure change that. I'll look at it more in-depth as well.

|||

Gerald , Remus:

Thank you...it worked

Pramod