Showing posts with label follows. Show all posts
Showing posts with label follows. Show all posts

Tuesday, March 20, 2012

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

Hi all,

I am new to SQL 2005. I have one issue and it is as follows:

I write a simple query and run it; it works fine.

Now I break the network connection and run the query; in this case it runs fine.

But when I reconnect the network and run the query, then I get an error as follows:

"A transport-level error has occurred when sending the request to the server. (provider: Named Pipes Provider, error: 0 - An unexpected network error occurred.) "

Every thing is local here. So how the network issue comes here?

For some reason the connection was made through Named Pipes instead of Shared Memory (the default for local connections), which suggests that SqlClient did not recognize the connection was local, and most likely tunneled Named Pipes over TCP, hence, disocnnecting the network has impact.

How do you specify the server name - perhaps by its fully qualified domain name (FQDN), or IP address?

If you specify it by the hostname or "." or "(local)" SqlClient should recognize the local connection, and you should not see the error.

|||

Hi ,

sorry to reply late.

I tried the above mentioned case. In case of "." or "(local)" it did not connect to the SQL server. When I try it by the host name then same original problem persist.

Thanks

|||

Well sorry once again!!!

I made some mistake in the above reply.

I tried as mentioned in the solution and here are the results:

In case of "." it works fine

In case of host name the problem still persists.

for "(local)" I have not yet tested.

Thanks

|||

Regarding the host name problem - do you specify the server name exactly the same way as returned by the Windows hostname command-line command?

|||

Yes, I specify the server name exactly as returned by the the windows hostname command-line command. But the problem still persists.

|||

Great post ~ I had the same problem.

When trying to connect to a local SQL Server I was using 'localhost', which resulted in "A transport-level error has occurred...".

To resolve, I replaced 'localhost' with '(local)', as suggested.

Regards.

|||I same the same problem but I am connecting to remote server using IP, any idea?

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

Hi all,

I am new to SQL 2005. I have one issue and it is as follows:

I write a simple query and run it; it works fine.

Now I break the network connection and run the query; in this case it runs fine.

But when I reconnect the network and run the query, then I get an error as follows:

"A transport-level error has occurred when sending the request to the server. (provider: Named Pipes Provider, error: 0 - An unexpected network error occurred.) "

Every thing is local here. So how the network issue comes here?

For some reason the connection was made through Named Pipes instead of Shared Memory (the default for local connections), which suggests that SqlClient did not recognize the connection was local, and most likely tunneled Named Pipes over TCP, hence, disocnnecting the network has impact.

How do you specify the server name - perhaps by its fully qualified domain name (FQDN), or IP address?

If you specify it by the hostname or "." or "(local)" SqlClient should recognize the local connection, and you should not see the error.

|||

Hi ,

sorry to reply late.

I tried the above mentioned case. In case of "." or "(local)" it did not connect to the SQL server. When I try it by the host name then same original problem persist.

Thanks

|||

Well sorry once again!!!

I made some mistake in the above reply.

I tried as mentioned in the solution and here are the results:

In case of "." it works fine

In case of host name the problem still persists.

for "(local)" I have not yet tested.

Thanks

|||

Regarding the host name problem - do you specify the server name exactly the same way as returned by the Windows hostname command-line command?

|||

Yes, I specify the server name exactly as returned by the the windows hostname command-line command. But the problem still persists.

|||

Great post ~ I had the same problem.

When trying to connect to a local SQL Server I was using 'localhost', which resulted in "A transport-level error has occurred...".

To resolve, I replaced 'localhost' with '(local)', as suggested.

Regards.

|||I same the same problem but I am connecting to remote server using IP, any idea?

Monday, March 19, 2012

A syntax error

Hi,

I write a test DMX as follows to expriment

cmd.CommandText = "SELECT FLATTENED " +
"( SELECT *, PredictStdev(BloodPressure) AS Stdev " +
"FROM PredictTimeSeries(BloodPressure, " + numTimePoints + ")" +
") " +
"FROM " + modelName;

However, after execute this command, a error show:

The syntax for 'Stdev' is incorrect. I have no idea about the reason to raise to error.

How can I fix it and why this error occur?

Any help would be welcome.

Ricky.

Stdev is a keyword in the language supported by our server. To use it as a column name, you need to use brackets:

cmd.CommandText = "SELECT FLATTENED " +
"( SELECT *, PredictStdev(BloodPressure) AS [Stdev] " +
"FROM PredictTimeSeries(BloodPressure, " + numTimePoints + ")" +
") " +
"FROM " + modelName;|||

Thx Bogdan.

Regards,

Ricky

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
>
>

Monday, February 13, 2012

A more efficient query

I am trying to add and subtract a few fields in a table to determine return
on investment
Currently i'm performing this as follows:
SELECT
(ColumnCost1 + ColumnCost2) as Cost,
(ColumnRevenue1 + ColumnRevenue2) as Revenue,
((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 + ColumnCost2)) as
ReturnOnInvestment
FROM
TableName
Is there a more efficient way of doing this, i am calling the same
calcutions twice so it seems there must be.
I tried setting variables to the costs and revenues, but multiple results
are being returned so this proved difficult.
Any help would be appreciated, thanksYou could try a derived table, but I seriously doubt you'll see any
performance increase:
SELECT
Cost, Revenue
(Revenue - Cost) as ReturnOnInvestment
FROM
(SELECT
(ColumnCost1 + ColumnCost2) as Cost,
(ColumnRevenue1 + ColumnRevenue2) as Revenue
FROM TableName) x(Cost, Revenue)
"GrantMagic" <grant@.magicalia.com> wrote in message
news:OM9DXmckEHA.3340@.TK2MSFTNGP14.phx.gbl...
> I am trying to add and subtract a few fields in a table to determine
return
> on investment
> Currently i'm performing this as follows:
> SELECT
> (ColumnCost1 + ColumnCost2) as Cost,
> (ColumnRevenue1 + ColumnRevenue2) as Revenue,
> ((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 + ColumnCost2))
as
> ReturnOnInvestment
> FROM
> TableName
> Is there a more efficient way of doing this, i am calling the same
> calcutions twice so it seems there must be.
> I tried setting variables to the costs and revenues, but multiple results
> are being returned so this proved difficult.
>
> Any help would be appreciated, thanks
>|||Yeah, i tested the two methods against each other and there is no difference
between the two
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%238hGNqckEHA.3988@.TK2MSFTNGP14.phx.gbl...
> You could try a derived table, but I seriously doubt you'll see any
> performance increase:
>
> SELECT
> Cost, Revenue
> (Revenue - Cost) as ReturnOnInvestment
> FROM
> (SELECT
> (ColumnCost1 + ColumnCost2) as Cost,
> (ColumnRevenue1 + ColumnRevenue2) as Revenue
> FROM TableName) x(Cost, Revenue)
>
> "GrantMagic" <grant@.magicalia.com> wrote in message
> news:OM9DXmckEHA.3340@.TK2MSFTNGP14.phx.gbl...
> > I am trying to add and subtract a few fields in a table to determine
> return
> > on investment
> >
> > Currently i'm performing this as follows:
> >
> > SELECT
> > (ColumnCost1 + ColumnCost2) as Cost,
> > (ColumnRevenue1 + ColumnRevenue2) as Revenue,
> > ((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 +
ColumnCost2))
> as
> > ReturnOnInvestment
> > FROM
> > TableName
> >
> > Is there a more efficient way of doing this, i am calling the same
> > calcutions twice so it seems there must be.
> >
> > I tried setting variables to the costs and revenues, but multiple
results
> > are being returned so this proved difficult.
> >
> >
> > Any help would be appreciated, thanks
> >
> >
>|||You could try creating computed columns and index them. That might be quite
a bit faster...
ALTER TABLE TableName
ADD Cost AS (ColumnCost1 + ColumnCost2)
ALTER TABLE TableName
ADD Revenue AS (ColumnRevenue1 + ColumnRevenue2)
ALTER TABLE TableName
ADD ReturnOnInvestment AS
((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 + ColumnCost2))
CREATE INDEX IX_Cost_Revenue ON TableName (Cost, Revenue,
ReturnOnInvestment)
-- You should probably try to make this into a covering index, with the
rest of the columns in your real query
"GrantMagic" <grant@.magicalia.com> wrote in message
news:uhlLd6ckEHA.2848@.TK2MSFTNGP15.phx.gbl...
> Yeah, i tested the two methods against each other and there is no
difference
> between the two
> "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
> news:%238hGNqckEHA.3988@.TK2MSFTNGP14.phx.gbl...
> > You could try a derived table, but I seriously doubt you'll see any
> > performance increase:
> >
> >
> > SELECT
> > Cost, Revenue
> > (Revenue - Cost) as ReturnOnInvestment
> > FROM
> > (SELECT
> > (ColumnCost1 + ColumnCost2) as Cost,
> > (ColumnRevenue1 + ColumnRevenue2) as Revenue
> > FROM TableName) x(Cost, Revenue)
> >
> >
> > "GrantMagic" <grant@.magicalia.com> wrote in message
> > news:OM9DXmckEHA.3340@.TK2MSFTNGP14.phx.gbl...
> > > I am trying to add and subtract a few fields in a table to determine
> > return
> > > on investment
> > >
> > > Currently i'm performing this as follows:
> > >
> > > SELECT
> > > (ColumnCost1 + ColumnCost2) as Cost,
> > > (ColumnRevenue1 + ColumnRevenue2) as Revenue,
> > > ((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 +
> ColumnCost2))
> > as
> > > ReturnOnInvestment
> > > FROM
> > > TableName
> > >
> > > Is there a more efficient way of doing this, i am calling the same
> > > calcutions twice so it seems there must be.
> > >
> > > I tried setting variables to the costs and revenues, but multiple
> results
> > > are being returned so this proved difficult.
> > >
> > >
> > > Any help would be appreciated, thanks
> > >
> > >
> >
> >
>|||Thanks, i will give that a try.
Would i need to drop those columns after my query, or only create them once?
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:eBh6oPdkEHA.3356@.TK2MSFTNGP15.phx.gbl...
> You could try creating computed columns and index them. That might be
quite
> a bit faster...
> ALTER TABLE TableName
> ADD Cost AS (ColumnCost1 + ColumnCost2)
> ALTER TABLE TableName
> ADD Revenue AS (ColumnRevenue1 + ColumnRevenue2)
> ALTER TABLE TableName
> ADD ReturnOnInvestment AS
> ((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 + ColumnCost2))
> CREATE INDEX IX_Cost_Revenue ON TableName (Cost, Revenue,
> ReturnOnInvestment)
> -- You should probably try to make this into a covering index, with the
> rest of the columns in your real query
> "GrantMagic" <grant@.magicalia.com> wrote in message
> news:uhlLd6ckEHA.2848@.TK2MSFTNGP15.phx.gbl...
> > Yeah, i tested the two methods against each other and there is no
> difference
> > between the two
> >
> > "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
> > news:%238hGNqckEHA.3988@.TK2MSFTNGP14.phx.gbl...
> > > You could try a derived table, but I seriously doubt you'll see any
> > > performance increase:
> > >
> > >
> > > SELECT
> > > Cost, Revenue
> > > (Revenue - Cost) as ReturnOnInvestment
> > > FROM
> > > (SELECT
> > > (ColumnCost1 + ColumnCost2) as Cost,
> > > (ColumnRevenue1 + ColumnRevenue2) as Revenue
> > > FROM TableName) x(Cost, Revenue)
> > >
> > >
> > > "GrantMagic" <grant@.magicalia.com> wrote in message
> > > news:OM9DXmckEHA.3340@.TK2MSFTNGP14.phx.gbl...
> > > > I am trying to add and subtract a few fields in a table to determine
> > > return
> > > > on investment
> > > >
> > > > Currently i'm performing this as follows:
> > > >
> > > > SELECT
> > > > (ColumnCost1 + ColumnCost2) as Cost,
> > > > (ColumnRevenue1 + ColumnRevenue2) as Revenue,
> > > > ((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 +
> > ColumnCost2))
> > > as
> > > > ReturnOnInvestment
> > > > FROM
> > > > TableName
> > > >
> > > > Is there a more efficient way of doing this, i am calling the same
> > > > calcutions twice so it seems there must be.
> > > >
> > > > I tried setting variables to the costs and revenues, but multiple
> > results
> > > > are being returned so this proved difficult.
> > > >
> > > >
> > > > Any help would be appreciated, thanks
> > > >
> > > >
> > >
> > >
> >
> >
>|||"GrantMagic" <grant@.magicalia.com> wrote in message
news:uD9r5idkEHA.556@.tk2msftngp13.phx.gbl...
> Thanks, i will give that a try.
> Would i need to drop those columns after my query, or only create them
once?
Only once, they'll be columns in your table after that, just like any
other column (except you won't be able to update them; they'll be
automatically computed when you insert or update the other columns)|||GrantMagic,
These calculations are so basic and highly optimized for any CPU, that
there will be no way to create any significant performance gain by
rewriting the statement. The current cost of the calculation part is
simply too low (in comparison with I/O, network speed, logical reads,
etc.)
Gert-Jan
GrantMagic wrote:
> I am trying to add and subtract a few fields in a table to determine return
> on investment
> Currently i'm performing this as follows:
> SELECT
> (ColumnCost1 + ColumnCost2) as Cost,
> (ColumnRevenue1 + ColumnRevenue2) as Revenue,
> ((ColumnRevenue1 + ColumnRevenue2) - (ColumnCost1 + ColumnCost2)) as
> ReturnOnInvestment
> FROM
> TableName
> Is there a more efficient way of doing this, i am calling the same
> calcutions twice so it seems there must be.
> I tried setting variables to the costs and revenues, but multiple results
> are being returned so this proved difficult.
> Any help would be appreciated, thanks
--
(Please reply only to the newsgroup)