Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

Thursday, March 22, 2012

A urgent Replication Issue

A very urgent solution needed I have one main feed Server "A" replicating data to two Servers "B" & "C"

The Distribution agent profiles of Both "B" and "C" are as follows

"B" Distribution Agent Profile

-BcpBatchSize 100000 (default)
-CommitBatchSize 100 (default)
-CommitBatchThreshold 1000 (default)
-HistoryVerboseLevel 1 (default)
-KeepAliveMessageInterval 300 (default)
-LoginTimeOut 15 (default)
-MaxBcpThreads 1 (default)
-MaxDeliveredTransactions 0 (default)
-PollingInterval 10 (default)
-QueryTimeOut 2000
-SkipErrors 2601:2627:20598
-TransactionsPerHistory 100 (default)

"C" Distribution Agent Profile

-BcpBatchSize 100000 (default)
-CommitBatchSize 100 (default)
-CommitBatchThreshold 1000 (default)
-HistoryVerboseLevel 1 (default)
-KeepAliveMessageInterval 300 (default)
-LoginTimeOut 15 (default)
-MaxBcpThreads 1 (default)
-MaxDeliveredTransactions 0 (default)
-PollingInterval 10 (default)
-QueryTimeOut 300
-SkipErrors 2601:2627:20598
-TransactionsPerHistory 100 (default)

The latency for the server "B" is around 500000 & for the Server "C" is around 3000

Can u suggest anything wrong in the agent profile which can cause the Server LAtency to Shoot Up. what is the QueryTimeOut property about

thanks in advance

JAcx

I would take a look at the resources on Server B. You have a bottleneck somewhere over there which is causing things to move much more slowly than to other subscribers.|||Network connectivity between the 2?

Tuesday, March 20, 2012

A transport-level error has occurred when sending the request to the server

I've tried to search on the web for a solution for this error but i didn't find any working solutions for this problem. We have 2 servers. The first one is the server we use to develop our ASP.NET 2 application. On this server we don't have this error. On the other server (use by our client) we have this error sometime and i don't know why. Both servers have the same configuration and both application have the same web.config file.

I've tried to add a try-catch and retry the query when the error occured. This seems to be working but we don't want to have to change all our connections and since we don't have this problem on the other server we want to find the source of the problem.

Any idea ?

Thanks !

The most frequent cause of this error is restarting SQL Server. Another known cause is altering a database, e.g. from READ_ONLY to READ_WRITE, or taking a database offline/online.

Do any of these apply to your case?

Sunday, March 11, 2012

A SOLUTION FOR THAT QUERY

It follows the following query below:
Select rel_30.cpf, rel_30.cliente, rel_30.enderecoentrega
from rel_30
where (((rel_30.enderecoentrega)In (Select FROM [enderecoentrega] FROM
[Rel_30] As Tmp GROUP BY [enderecoentrega]HAVING
Count(enderecoentrega)>2)));
* Of the way that is brings the following result, former:
CUSTOMER CPF ENDERECOENTREGA
Fulano de tal 961232333-87 Rua Hum 10
Fulano de tal 961232333-87 Rua Hum 10
Fulano de tal 961232333-87 Rua Hum 10
Beltrano de tal 333333333-00 Rua Dois 20
Beltrano de tal 333333333-00 Rua Dois 20
Beltrano de tal 444444444-00 Rua Dois 20
In other words, more than two addresses similar with different CPFs, BUT
also brought same addresses and same CPFs, the first 3 RECORDS don't want,
only the remaining.
I DON'T GET ANY IN WAY TO FIND A SOLUTION FOR THAT QUERYI Apologize for not getting your english so well, but if I understand you,
then this should work.. Let me know:
Select R.cpf, R.cliente, R.enderecoentrega
from rel_30 R
Where (Select Count(*) From Rel_30
Where enderecoentrega = R.enderecoentrega) > 2
And Exists
(Select * From Rel_30
Where enderecoentrega = R.enderecoentrega
Group By cpf
Having Count(*) > 1)
"Frank Dulk" wrote:

> It follows the following query below:
> Select rel_30.cpf, rel_30.cliente, rel_30.enderecoentrega
> from rel_30
> where (((rel_30.enderecoentrega)In (Select FROM [enderecoentrega] FROM
> [Rel_30] As Tmp GROUP BY [enderecoentrega]HAVING
> Count(enderecoentrega)>2)));
> * Of the way that is brings the following result, former:
> CUSTOMER CPF ENDERECOENTREGA
> Fulano de tal 961232333-87 Rua Hum 10
> Fulano de tal 961232333-87 Rua Hum 10
> Fulano de tal 961232333-87 Rua Hum 10
> Beltrano de tal 333333333-00 Rua Dois 20
> Beltrano de tal 333333333-00 Rua Dois 20
> Beltrano de tal 444444444-00 Rua Dois 20
> In other words, more than two addresses similar with different CPFs, BUT
> also brought same addresses and same CPFs, the first 3 RECORDS don't want,
> only the remaining.
> I DON'T GET ANY IN WAY TO FIND A SOLUTION FOR THAT QUERY
>
>|||Hi Frank
Maybe you need something like:
Select DISTINCT r.cpf, r.cliente, r.enderecoentrega
from rel_30 r
where EXISTS (
Select 1 FROM [Rel_30] s
WHERE r.enderecoentrega = s.enderecoentrega
AND r.cpf = s.cpf
GROUP BY s.[enderecoentrega]
HAVING Count(DISTINCT s.cliente) > 1 )
or
Select DISTINCT r.cpf, r.cliente, r.enderecoentrega
from rel_30 r
where (
SELECT Count(DISTINCT s.cliente) FROM [Rel_30] s
WHERE r.enderecoentrega = s.enderecoentrega
AND r.cpf = s.cpf ) > 1
Check out how to post DDL and example data at
http://www.aspfaq.com/etiquett___e.asp?id=5006 and
example data as insert statements
http://vyaskn.tripod.com/code.___htm#inserts
regarding what is useful when posting a question.
John
"Frank Dulk" wrote:

> It follows the following query below:
> Select rel_30.cpf, rel_30.cliente, rel_30.enderecoentrega
> from rel_30
> where (((rel_30.enderecoentrega)In (Select FROM [enderecoentrega] FROM
> [Rel_30] As Tmp GROUP BY [enderecoentrega]HAVING
> Count(enderecoentrega)>2)));
> * Of the way that is brings the following result, former:
> CUSTOMER CPF ENDERECOENTREGA
> Fulano de tal 961232333-87 Rua Hum 10
> Fulano de tal 961232333-87 Rua Hum 10
> Fulano de tal 961232333-87 Rua Hum 10
> Beltrano de tal 333333333-00 Rua Dois 20
> Beltrano de tal 333333333-00 Rua Dois 20
> Beltrano de tal 444444444-00 Rua Dois 20
> In other words, more than two addresses similar with different CPFs, BUT
> also brought same addresses and same CPFs, the first 3 RECORDS don't want,
> only the remaining.
> I DON'T GET ANY IN WAY TO FIND A SOLUTION FOR THAT QUERY
>
>

a solution

Hi,

I know this issue exisits in DTS but needs to check still is in SSIS, Also you guys may have a better solution for it.

Issue: When I try to import a column from excel which has data like A,B,C,D,E,4,5 in the destination table has the data type as varchar it imports only A,B,C,D,E and 4 & 5 as nulls. How to fix this.

Set the Excel connection Extended Property, IMEX=1.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1294377&SiteID=1|||Thanks, it worked. Appreciated.|||

Imex=1 worked for all the cells except few, this column has data like below

07AWA38V36 0717062042 715018020 07BCB01R17

even in this column some has been imported correctly and few are imported like 7.15E+...

Note: My desination column data type in Varchar.

|||Make sure that Excel doesn't have any formatting for the problem cells or the problem column.|||In the above example for the second row the data was formatted as text becasue it has the leading Zero where as the third is not formatted becuase it doesnt have any leading zero. the issue was in the third row coverting as 7.15E+.. while running the SSIS|||

yes, i′ve got just the same problem.

incredibly it didn′t happen the first time i runned the dts, but now..

|||

..and i just got it..

I selected the whole worksheek, converted the cells into numeric type (format/cells/numeric) and saved. Then i converted the cells into General type again, saved and runned the dts. And it works now.

Better not to use Text types when it happens. When you′ve got a Text type it doesnt work properly, and if you change to General => it doesnt work either. But if you had Numeric types and change to General then it works.

|||

When I change this to Numeric then I will loose the leading zero in the 2 & 3 row.

|||

? no, you wont..

It′s just an excel fail, i doesnt catch properly that there′s a number, not a text, when you had a text previously

a solution

Hi,

I know this issue exisits in DTS but needs to check still is in SSIS, Also you guys may have a better solution for it.

Issue: When I try to import a column from excel which has data like A,B,C,D,E,4,5 in the destination table has the data type as varchar it imports only A,B,C,D,E and 4 & 5 as nulls. How to fix this.

Set the Excel connection Extended Property, IMEX=1.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1294377&SiteID=1|||Thanks, it worked. Appreciated.|||

Imex=1 worked for all the cells except few, this column has data like below

07AWA38V36 0717062042 715018020 07BCB01R17

even in this column some has been imported correctly and few are imported like 7.15E+...

Note: My desination column data type in Varchar.

|||Make sure that Excel doesn't have any formatting for the problem cells or the problem column.|||In the above example for the second row the data was formatted as text becasue it has the leading Zero where as the third is not formatted becuase it doesnt have any leading zero. the issue was in the third row coverting as 7.15E+.. while running the SSIS|||

yes, i′ve got just the same problem.

incredibly it didn′t happen the first time i runned the dts, but now..

|||

..and i just got it..

I selected the whole worksheek, converted the cells into numeric type (format/cells/numeric) and saved. Then i converted the cells into General type again, saved and runned the dts. And it works now.

Better not to use Text types when it happens. When you′ve got a Text type it doesnt work properly, and if you change to General => it doesnt work either. But if you had Numeric types and change to General then it works.

|||

When I change this to Numeric then I will loose the leading zero in the 2 & 3 row.

|||

? no, you wont..

It′s just an excel fail, i doesnt catch properly that there′s a number, not a text, when you had a text previously

a solution

Hi,

I know this issue exisits in DTS but needs to check still is in SSIS, Also you guys may have a better solution for it.

Issue: When I try to import a column from excel which has data like A,B,C,D,E,4,5 in the destination table has the data type as varchar it imports only A,B,C,D,E and 4 & 5 as nulls. How to fix this.

Set the Excel connection Extended Property, IMEX=1.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1294377&SiteID=1|||Thanks, it worked. Appreciated.|||

Imex=1 worked for all the cells except few, this column has data like below

07AWA38V36 0717062042 715018020 07BCB01R17

even in this column some has been imported correctly and few are imported like 7.15E+...

Note: My desination column data type in Varchar.

|||Make sure that Excel doesn't have any formatting for the problem cells or the problem column.|||In the above example for the second row the data was formatted as text becasue it has the leading Zero where as the third is not formatted becuase it doesnt have any leading zero. the issue was in the third row coverting as 7.15E+.. while running the SSIS|||

yes, i′ve got just the same problem.

incredibly it didn′t happen the first time i runned the dts, but now..

|||

..and i just got it..

I selected the whole worksheek, converted the cells into numeric type (format/cells/numeric) and saved. Then i converted the cells into General type again, saved and runned the dts. And it works now.

Better not to use Text types when it happens. When you′ve got a Text type it doesnt work properly, and if you change to General => it doesnt work either. But if you had Numeric types and change to General then it works.

|||

When I change this to Numeric then I will loose the leading zero in the 2 & 3 row.

|||

? no, you wont..

It′s just an excel fail, i doesnt catch properly that there′s a number, not a text, when you had a text previously

a small SQL Puzzle

Hi,

Probable there is a simple solution for this, hopefully someone can
direct me in the right direction.

I have a table with a persons firstname, lastname, birthdate and
address. However, I want to select only one person per address, namely
the eldest of all persons living on the same address.

Can anyone provide me a solution?

Thanks in advance.
DuncanUnless there are twins who are both the oldest this will do what you
ask.

SELECT *
FROM SomeTable as A
WHERE birthdate =
(SELECT MIN(birthdate)
FROM SomeTable as B
WHERE A.address = B.address)

Roy Harvey
Beacon Falls, CT

On Wed, 26 Sep 2007 20:37:12 +0200, Fiori <dab@.xs4all.nlwrote:

Quote:

Originally Posted by

>Hi,
>
>Probable there is a simple solution for this, hopefully someone can
>direct me in the right direction.
>
>I have a table with a persons firstname, lastname, birthdate and
>address. However, I want to select only one person per address, namely
>the eldest of all persons living on the same address.
>
>Can anyone provide me a solution?
>
>Thanks in advance.
>Duncan

|||Thank you.

Roy Harvey (SQL Server MVP) schreef:

Quote:

Originally Posted by

Unless there are twins who are both the oldest this will do what you
ask.
>
SELECT *
FROM SomeTable as A
WHERE birthdate =
(SELECT MIN(birthdate)
FROM SomeTable as B
WHERE A.address = B.address)
>
Roy Harvey
Beacon Falls, CT
>

a slight improvement to a great solution...

This is a great solution! I've modified it a bit to make it a little more
manageable though for my own use. I decided to make a version where the row
colors could be centrally managed since you have to copy the expression to
every cell in the row... and in some reports that can be a lot of cells...
this way you can define the color scheme in one place.. and you can also use
row level formatting. Here is how i did this.
Custom Code as follows:
Dim Public bgColor1 As String = "White"
Dim Public bgColor2 As String = "WhiteSmoke"
Dim Public bgColor As String = bgColor2
Public Function getBgColor(switch As Boolean) As String
If switch
If bgColor = bgColor1
bgColor = bgColor2
else
bgColor = bgColor1
end if
end if
return bgColor
End Function
Highlight the ROW and put in the following expression for BackgroundColor
property:
=Code.getBgColor(false)
Then all you have to do is go into the FIRST cell of the row and change it to:
=Code.getBgColor(true)
and walla works great (just like the original) with centralize management of
the row colors...
just a little change on a great solution...And what happens with concurrent users generating the same report?
Since bgColor is a public shared variable your code will run into problems.
Have a look at: http://odetocode.com/Articles/130.aspx
[...]
While shared methods are recommended, shared fields are definitely not. For
instance, the following code will have problems.
Public Shared Function AddToCount(ByVal Value As Integer) As String
Count = Count + value
End Function
Shared Count As Integer = 0
First, we have no control over the lifetime of the variable Count. Secondly,
if multiple users are executing the report with this code at the same time,
both reports will be changing the same Count field (that is why it is a
shared field). You don't want to debug these sorts of interactions - stick
to shared functions using only local variables (variables passed ByVal or
declared in the function body).
[...]
"thejez" <thejez@.discussions.microsoft.com> escribió en el mensaje
news:48D9ED94-AE6B-47C3-B1A9-C35DE05D4E08@.microsoft.com...
> This is a great solution! I've modified it a bit to make it a little more
> manageable though for my own use. I decided to make a version where the
> row
> colors could be centrally managed since you have to copy the expression to
> every cell in the row... and in some reports that can be a lot of cells...
> this way you can define the color scheme in one place.. and you can also
> use
> row level formatting. Here is how i did this.
> Custom Code as follows:
> Dim Public bgColor1 As String = "White"
> Dim Public bgColor2 As String = "WhiteSmoke"
> Dim Public bgColor As String = bgColor2
> Public Function getBgColor(switch As Boolean) As String
> If switch
> If bgColor = bgColor1
> bgColor = bgColor2
> else
> bgColor = bgColor1
> end if
> end if
> return bgColor
> End Function
> Highlight the ROW and put in the following expression for BackgroundColor
> property:
> =Code.getBgColor(false)
> Then all you have to do is go into the FIRST cell of the row and change it
> to:
> =Code.getBgColor(true)
> and walla works great (just like the original) with centralize management
> of
> the row colors...
> just a little change on a great solution...|||hrmmm this was supposed to be a reply to a previous post... and now i cant
even find that original post anymore (think it was posted originally on
5/27/05)...
anyway here the original post:
"G" wrote:
> Ok, I found my workaround. Someone is bound to have this issue sometime in
> the future, so I'll put the workaround here.
> I created a little routine in the custom Code area of the report that simply
> toggles and returns an integer value:
> Dim Public bgColor As Integer = 0
> Public Function alternateColor As Integer
> If bgColor = 0
> bgColor = 1
> return bgColor
> else
> bgColor = 0
> return bgColor
> end if
> End Function
> When i put my method call in the background color on the entire table ROW,
> the result was alternating COLUMN colors. This is because the method was
> called for every cell (column) in the row. In order to get alternating ROW
> color, I only called the alternateColor routine in the FIRST column in the
> table row (iif(Code.alternateColor() = 0, "white", "grey")). Each subsequent
> column in the row would simply check the "Code.bgColor" value for its
> current value, and base its color on that (iif(Code.bgColor = 0, "white",
> "grey")).
> Maybe this will come in handy for someone else someday....
> Brian
> "G" wrote in message
> news:OSJrwjtYFHA.1152@.tk2msftngp13.phx.gbl...
> > Got a dataset that is used to populate a table. Want to alternate the
> > background color on every other row in the displayed detail group. Easy
> > enough right? Here's the catch: the output is grouped at display time. A
> > query output might be:
> >
> > KEY Value1 Value2
> > A 0 1
> > A 1 0
> > B 5 0
> > C 3 0
> > C 0 7
> >
> > etc...
> >
> > The DISPLAY output is grouped on the KEY, and the two values are summed to
> > give me a display such as:
> >
> > KEY Value1 Value2
> > A 1 1
> > B 5 0
> > C 3 7
> >
> > Problem. When I use the standard "=iif(RowNumber(Nothing) MOD 2, "White",
> > "Grey")", it counts EVERY row returned from the original query, not the
> > grouped output, so I don't get a uniform white-grey-white pattern. Anyone
> > know a workaround for this?
> >
> > TIA,
> >
> > Brian
> >
>
>

Thursday, March 8, 2012

A severe error occurred on the current command

I get this weird error. Was wondering whether anyone could help here with fi
nding a solution.
SqlException: A severe error occurred on the current command. The results,
if any, should be discarded.
I'm using 2 SQL 2000 Servers. Server A and Server B. I have a Stored
Procedure on Server A that executes a Stored Procedure on Server B. What's o
dd is that i can run the Stored Procedure on Server A in Query Analyzer and
it works
great... as expected... but when i call it in ASP.NET (VB.NET), i get the se
vere error
message.
Can you help me here with what is causing this and how can I get over with t
his error.
Thanks
Reji
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...Reji,
That error is being produced by ADO.NET, not by SQL Server. It's a
SqlException... Have you tried debugging your call to the stored procedure?
You might want to post this question in an ADO.NET specific group, or
perhaps microsoft.public.dotnet.languages.vb.data would be more helpful.
"Reji" <am_saved@.yahoo.com> wrote in message
news:%23wkbf%23BaEHA.3888@.TK2MSFTNGP10.phx.gbl...
> I get this weird error. Was wondering whether anyone could help here with
finding a solution.
> SqlException: A severe error occurred on the current command. The results,
> if any, should be discarded.
> I'm using 2 SQL 2000 Servers. Server A and Server B. I have a Stored
> Procedure on Server A that executes a Stored Procedure on Server B. What's
odd is that i can run the Stored Procedure on Server A in Query Analyzer and
it works
> great... as expected... but when i call it in ASP.NET (VB.NET), i get the
severe error
> message.
> Can you help me here with what is causing this and how can I get over with
this error.
> Thanks
> Reji
>
> ****************************************
******************************
> Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...|||Thanks much Adam. Appreciate the help. Have posted the same in the forum you
said. Hope some one would answer me.
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...|||See whether this KBA http://support.microsoft.com/defaul...;82736
6 is any help to resolve.
--
--
Satya SKJ
"Adam Machanic" wrote:

> Reji,
> That error is being produced by ADO.NET, not by SQL Server. It's a
> SqlException... Have you tried debugging your call to the stored procedure
?
> You might want to post this question in an ADO.NET specific group, or
> perhaps microsoft.public.dotnet.languages.vb.data would be more helpful.
>
> "Reji" <am_saved@.yahoo.com> wrote in message
> news:%23wkbf%23BaEHA.3888@.TK2MSFTNGP10.phx.gbl...
> finding a solution.
> odd is that i can run the Stored Procedure on Server A in Query Analyzer a
nd
> it works
> severe error
> this error.
> ASP.NET resources...
>
>

Monday, February 13, 2012

A more complicated case of insertion filtering by more than two fields

Hi,

I posted a problem some hours ago. I found that the solution that l was given by Karolyn was great, but at that time I didn't realize that my problem was a little bit more complicated. I'll rephrase my problem:

I need to insert some registers in a table. These registers have three fileds: col1, col2 and col3. I don't want to insert a register if in the table already exists a row with the col1, col2 and col3 combination of that register. These fields are PK, but I don't want to get errors. The problem is that I'm inserting a field that belongs also to the destination table. How can I filter a "destination" table by two fields in this case?

This the table1:

create table table1(
col1 int not null,
col2 int not null,
col3 int not null,
constraint PK_table1 primary key (col1, col2, col3)
)

Here's my "insert" code:

INSERT INTO table1
SELECT table2.col1, table3.col2, table1.col3
FROM table2, table3
WHERE table2.col1 = table3.col1

The third field in the SELECT now refers also to table1. Witch conditions should I add to avoid repetitions in table1 (avoiding also erroing)

Thanks

FedericoOriginally posted by fmilano

INSERT INTO table1
SELECT table2.col1, table3.col2,table1.col3
FROM table2, table3
WHERE table2.col1 = table3.col1


Doesn't make sense....