Friday, March 23, 2012
No connection to local SQL Server when no network connection
We are using Windows XP,
ADO.NET in our application (programming language: C#),
MS SQL Server 2000.
The computer is a SONY notebook.
SQL server is running on the same machine as the application.
The application has worked in many, many cases under W2K and even XP.
But on that computer it doesn't work:
When there is no network connection,
then the application CANNOT connect to our DB.
On the other hand, Enterprise Manager CAN connect.
When we plug in the network and restart the computer,
then the application CAN connect.
However, SQL Server is running locally !
The connection string for connecting our app to the database is something
like:
sqlConnection.ConnectionString =
"packet size=4096;user id=BIS;persist security info=false;initial
catalog=BIS; server=(local)";
How can we fix that problem ?
Your kind help would be appreciated.
Peter
I have had similar issues - am not sure why though.
However,I seem to be able to connect by either using the (local) or the
actual PC name - it just seems to change its behaviour depending on the
network connectivity status.
Hope this is of some help.
LeMuppet
lemuppet
Posted via http://www.webservertalk.com
View this thread: http://www.webservertalk.com/message411117.html
No connection to local SQL Server when no network connection
We are using Windows XP,
ADO in our application,
MS SQL Server 2000.
(Programming language: Delphi 5;
ADO components: from Adonis;
The computer is a SONY notebook).
SQL server is running on the same machine as the application.
The application has worked in many, many cases under W2K and even XP.
But on that computer it doesn't work:
When there is no network connection, then the application CANNOT connect to
our DB.
On the other hand, Enterprise Manager CAN connect.
When we plug in the network and restart the computer, then the application
CAN connect.
However, SQL Server is running locally !
The connection string for connecting our app to the database is something
like:
'Provider=SQLOLEDB.1; Password="";Persist Security Info=True;User
ID=Bis;Initial Catalog=BIS;Data Source=127.0.0.1'
How can we fix that problem ?
Is this a problem of MS SQL Server administration ?
Your kind help would be appreciated.
PeterThe soluition is to use named pipes to connect as
Enterprise manager will if IP: 127.0.0.1 cannot connect.
Change your connection string to :
'Provider=SQLOLEDB.1; Password="";Persist Security
Info=True;User
ID=Bis;Initial Catalog=BIS;Data Source=(local)'
This should fix the problem.
>--Original Message--
>Hi !
>We are using Windows XP,
>ADO in our application,
>MS SQL Server 2000.
>(Programming language: Delphi 5;
> ADO components: from Adonis;
> The computer is a SONY notebook).
>SQL server is running on the same machine as the
application.
>The application has worked in many, many cases under W2K
and even XP.
>But on that computer it doesn't work:
>When there is no network connection, then the application
CANNOT connect to
>our DB.
>On the other hand, Enterprise Manager CAN connect.
>When we plug in the network and restart the computer,
then the application
>CAN connect.
>However, SQL Server is running locally !
>The connection string for connecting our app to the
database is something
>like:
> 'Provider=SQLOLEDB.1; Password="";Persist Security
Info=True;User
>ID=Bis;Initial Catalog=BIS;Data Source=127.0.0.1'
>How can we fix that problem ?
>Is this a problem of MS SQL Server administration ?
>Your kind help would be appreciated.
>Peter
>
>.
>|||> Change your connection string to :
> 'Provider=SQLOLEDB.1; Password="";Persist Security
> Info=True;User
> ID=Bis;Initial Catalog=BIS;Data Source=(local)'
It worked.
Thanks a lot !
Friday, March 9, 2012
Next Object id already assigned
the programming group, but now that I've found more detail, I think it
is better suited to this group with a different title.
I can't create any objects in master. What I've found is that the
dbi_nextid is already assigned to another object. Can anyone offer
any suggestions? DBCC checkcatalog and dbcc checkdb return no errors.
create proc simpleproc as select * from sysobjects
returns
Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
There is already an object named 'simpleproc' in the database.
Further research has found the the dbi_nextid is already in use.
DBCC TRACEON(3604)
DBCC DBINFO('master')
DBCC TRACEOFF(3604)
returns
dbi_nextid = 1537440551
select name, type, id, crdate from sysobjects where id = 1537440551
returns
name type id crdate
sp_dropmergearticleP 15374405512003-03-09 18:00:50.177
select max(id) from master.dbo.sysobjects
returns
2145442717
@.@.version =
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation
Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
> Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
> There is already an object named 'simpleproc' in the database.
>
> Further research has found the the dbi_nextid is already in use.
Why did you go further? It appears you already have a procedure named
simpleproc, and this is why you can't create another one. How about change
the name to splungeproc and see if that works. Why are you creating these
procs in master anyway? How many objects are in master now?
http://www.aspfaq.com/
(Reverse address to reply.)
|||I went further because I need to get the proc created. It is an SMTP
mail proc that I ultimately need to create. I used the simpleproc
example so people would not have to wade through lines of code. I am
sure simpleproc does not exist
My problem is I can't create any object in master - regardless of the
name or type. Tables, views, stored procs all receive the same error -
object already exists. If I try and drop the object first, I get that
it does not exist.
select * from sysobjects where name = 'simpleproc'
go
drop proc dbo.simpleproc
go
create proc dbo.simpleproc as select * from sysobjects
returns
(0 row(s) affected)
Server: Msg 3701, Level 11, State 5, Line 3
Cannot drop the procedure 'dbo.simpleproc', because it does not exist in
the system catalog.
Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
There is already an object named 'simpleproc' in the database.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
|||What about my other questions? Why does this have to be in master? How
many objects are in master now?
http://www.aspfaq.com/
(Reverse address to reply.)
"Stephanie Harrell" <stephanie.harrell@.stateauto.com> wrote in message
news:uA3PgWCaEHA.2840@.TK2MSFTNGP11.phx.gbl...
> I went further because I need to get the proc created. It is an SMTP
> mail proc that I ultimately need to create. I used the simpleproc
> example so people would not have to wade through lines of code. I am
> sure simpleproc does not exist
|||A count of sysobjects returns 1305.
I am putting the proc in master because on all my other servers it is in
master. This is an enterprise wide proc developed for standard use in
sending emails from SQL. I don't want it to be in master on all the
other servers and a different database on this one. In hindsight, we
might have made this an extended stored proc, but there is too much code
to go back and change it now.
But all that is really beside the point. I should be able to create
objects in master - whether it is advisable or not - and I can't because
the "next object id" is already being used.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
|||This sounds like a known issue - please call Product Support who will assist
you.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Stephanie Harrell" <stephanie.harrell@.stateauto.com> wrote in message
news:u2A3XnCaEHA.3996@.TK2MSFTNGP12.phx.gbl...
> A count of sysobjects returns 1305.
> I am putting the proc in master because on all my other servers it is in
> master. This is an enterprise wide proc developed for standard use in
> sending emails from SQL. I don't want it to be in master on all the
> other servers and a different database on this one. In hindsight, we
> might have made this an extended stored proc, but there is too much code
> to go back and change it now.
> But all that is really beside the point. I should be able to create
> objects in master - whether it is advisable or not - and I can't because
> the "next object id" is already being used.
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!
|||Thank you Paul!!
Since you mentioned a known problem, I found KB Article
http://support.microsoft.com/default...48&Product=sql
And it did the trick. I could not get the supplied script to work, so
I simple coded a drop and create and duplicated the lines 50 or so
times. Then ran that until the object created successfully.
Thanks again
"Paul S Randal [MS]" <prandal@.online.microsoft.com> wrote in message news:<e0onLTHaEHA.3888@.TK2MSFTNGP10.phx.gbl>...[vbcol=seagreen]
> This sounds like a known issue - please call Product Support who will assist
> you.
> --
> Paul Randal
> Dev Lead, Microsoft SQL Server Storage Engine
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Stephanie Harrell" <stephanie.harrell@.stateauto.com> wrote in message
> news:u2A3XnCaEHA.3996@.TK2MSFTNGP12.phx.gbl...
Next Object id already assigned
the programming group, but now that I've found more detail, I think it
is better suited to this group with a different title.
I can't create any objects in master. What I've found is that the
dbi_nextid is already assigned to another object. Can anyone offer
any suggestions? DBCC checkcatalog and dbcc checkdb return no errors.
create proc simpleproc as select * from sysobjects
returns
Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
There is already an object named 'simpleproc' in the database.
Further research has found the the dbi_nextid is already in use.
DBCC TRACEON(3604)
DBCC DBINFO('master')
DBCC TRACEOFF(3604)
returns
dbi_nextid = 1537440551
select name, type, id, crdate from sysobjects where id = 1537440551
returns
name type id crdate
sp_dropmergearticle P 1537440551 2003-03-09 18:00:50.177
select max(id) from master.dbo.sysobjects
returns
2145442717
@.@.version =
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation
Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4)> Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
> There is already an object named 'simpleproc' in the database.
>
> Further research has found the the dbi_nextid is already in use.
Why did you go further? It appears you already have a procedure named
simpleproc, and this is why you can't create another one. How about change
the name to splungeproc and see if that works. Why are you creating these
procs in master anyway? How many objects are in master now?
--
http://www.aspfaq.com/
(Reverse address to reply.)
Next Object id already assigned
the programming group, but now that I've found more detail, I think it
is better suited to this group with a different title.
I can't create any objects in master. What I've found is that the
dbi_nextid is already assigned to another object. Can anyone offer
any suggestions? DBCC checkcatalog and dbcc checkdb return no errors.
create proc simpleproc as select * from sysobjects
returns
Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
There is already an object named 'simpleproc' in the database.
Further research has found the the dbi_nextid is already in use.
DBCC TRACEON(3604)
DBCC DBINFO('master')
DBCC TRACEOFF(3604)
returns
dbi_nextid = 1537440551
select name, type, id, crdate from sysobjects where id = 1537440551
returns
name type id crdate
sp_dropmergearticle P 1537440551 2003-03-09 18:00:50.177
select max(id) from master.dbo.sysobjects
returns
2145442717
@.@.version =
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation
Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4)> Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
> There is already an object named 'simpleproc' in the database.
>
> Further research has found the the dbi_nextid is already in use.
Why did you go further? It appears you already have a procedure named
simpleproc, and this is why you can't create another one. How about change
the name to splungeproc and see if that works. Why are you creating these
procs in master anyway? How many objects are in master now?
http://www.aspfaq.com/
(Reverse address to reply.)|||I went further because I need to get the proc created. It is an SMTP
mail proc that I ultimately need to create. I used the simpleproc
example so people would not have to wade through lines of code. I am
sure simpleproc does not exist
My problem is I can't create any object in master - regardless of the
name or type. Tables, views, stored procs all receive the same error -
object already exists. If I try and drop the object first, I get that
it does not exist.
select * from sysobjects where name = 'simpleproc'
go
drop proc dbo.simpleproc
go
create proc dbo.simpleproc as select * from sysobjects
returns
(0 row(s) affected)
Server: Msg 3701, Level 11, State 5, Line 3
Cannot drop the procedure 'dbo.simpleproc', because it does not exist in
the system catalog.
Server: Msg 2714, Level 16, State 5, Procedure simpleproc, Line 1
There is already an object named 'simpleproc' in the database.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!|||What about my other questions? Why does this have to be in master? How
many objects are in master now?
http://www.aspfaq.com/
(Reverse address to reply.)
"Stephanie Harrell" <stephanie.harrell@.stateauto.com> wrote in message
news:uA3PgWCaEHA.2840@.TK2MSFTNGP11.phx.gbl...
> I went further because I need to get the proc created. It is an SMTP
> mail proc that I ultimately need to create. I used the simpleproc
> example so people would not have to wade through lines of code. I am
> sure simpleproc does not exist|||A count of sysobjects returns 1305.
I am putting the proc in master because on all my other servers it is in
master. This is an enterprise wide proc developed for standard use in
sending emails from SQL. I don't want it to be in master on all the
other servers and a different database on this one. In hindsight, we
might have made this an extended stored proc, but there is too much code
to go back and change it now.
But all that is really beside the point. I should be able to create
objects in master - whether it is advisable or not - and I can't because
the "next object id" is already being used.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!|||This sounds like a known issue - please call Product Support who will assist
you.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Stephanie Harrell" <stephanie.harrell@.stateauto.com> wrote in message
news:u2A3XnCaEHA.3996@.TK2MSFTNGP12.phx.gbl...
> A count of sysobjects returns 1305.
> I am putting the proc in master because on all my other servers it is in
> master. This is an enterprise wide proc developed for standard use in
> sending emails from SQL. I don't want it to be in master on all the
> other servers and a different database on this one. In hindsight, we
> might have made this an extended stored proc, but there is too much code
> to go back and change it now.
> But all that is really beside the point. I should be able to create
> objects in master - whether it is advisable or not - and I can't because
> the "next object id" is already being used.
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!|||Thank you Paul!!
Since you mentioned a known problem, I found KB Article
http://support.microsoft.com/defaul...448&Product=sql
And it did the trick. I could not get the supplied script to work, so
I simple coded a drop and create and duplicated the lines 50 or so
times. Then ran that until the object created successfully.
Thanks again
"Paul S Randal [MS]" <prandal@.online.microsoft.com> wrote in message news:<e0onLTHaEHA.3
888@.TK2MSFTNGP10.phx.gbl>...[vbcol=seagreen]
> This sounds like a known issue - please call Product Support who will assi
st
> you.
> --
> Paul Randal
> Dev Lead, Microsoft SQL Server Storage Engine
> This posting is provided "AS IS" with no warranties, and confers no rights
.
> "Stephanie Harrell" <stephanie.harrell@.stateauto.com> wrote in message
> news:u2A3XnCaEHA.3996@.TK2MSFTNGP12.phx.gbl...
Monday, February 20, 2012
newbie: processing records sequentially
I'm a newbie to T-SQL but not to programming. What I want to do is
process every record in a table, and depending on the values in the
record itself, either copy the record to another table or update a
third table, and the delete the original record. Basically, it's a data
preparation area table where the records are imported with no error
check, and then validated against a set of conditions.
THE QUESTION IS: which approach should I follow? Is there a sort of
FORALL loop in T-SQL that I can execute on every record in the table?
Or shall I rely on other tools (VB Scripting, or...)? SQL Server 2000
Thanx to allIn SQL your goal should generally be to avoid processing data a row at
a time. This example may help you:
INSERT INTO AnotherTable (col1, col2, ...)
SELECT col1, col2, ...
FROM YourTable
WHERE ... ? /* unspecified */
UPDATE AnotherTable
SET ... ? /* unspecified */
WHERE ... /* uspecified */
DELETE FROM YourTable
WHERE ...
etc.
Hopefully this gives you the idea. If you need more help, please refer
to the following article which describes the best way to post a fuller
description of your problem:
http://www.aspfaq.com/etiquette.asp?id=5006
--
David Portas
SQL Server MVP
--|||David,
thanks for prompt response. I understand the process is somehow
reversed from a row-by-row cycle. It seems to me somehow inefficient,
though, to run a query against a third table twice in order to UPDATE
the first time and DELETE the second.
Cheers
David Portas wrote:
> In SQL your goal should generally be to avoid processing data a row at
> a time. This example may help you:
> INSERT INTO AnotherTable (col1, col2, ...)
> SELECT col1, col2, ...
> FROM YourTable
> WHERE ... ? /* unspecified */
> UPDATE AnotherTable
> SET ... ? /* unspecified */
> WHERE ... /* uspecified */
> DELETE FROM YourTable
> WHERE ...
> etc.
> Hopefully this gives you the idea. If you need more help, please refer
> to the following article which describes the best way to post a fuller
> description of your problem:
> http://www.aspfaq.com/etiquette.asp?id=5006|||It depends. INSERT, DELETE and UPDATE are separate operations so will
always require separate statements whatever method you use. The main
question is how best to optimise the WHERE selection criteria. You
didn't specify what those criteria are so I can only guess. It is at
least likely that putting the criteria in WHERE clauses, with suitable
indexes, will be much more efficient than the overhead of looping
through each row in a cursor. Understand that SQL is a declarative
language, unlike procedural languages that you are probably more
familiar with.Cursor processing (row by row) is rarely a good idea in
SQL and when manipulating data should usually be a last resort only.
--
David Portas
SQL Server MVP
--|||>> I'm a newbie to T-SQL but not to programming.<<
You missed the point of a declarative, set-oriented language and it
will take you about a year to un-learn your old mental models. I have
a book entitled SQL PROGRAMMING STYLE that deals with this problem in a
few chapters.
>> What I want to do is process every record [sic] in a table, and
depending on the values in the record [sic] itself, either copy the
record [sic] to another table or update a third table, and the delete
the original record [sic] . <<
This is a common problem; rows are not records, tables are not files
and columns are not fields. Totally differrent concepts. I will give
you the long painful details that I post on this topic if you ask.
Have you ever worked with LISP, FP, Prolog or a language that was not
based on procedures? This is a new way of thinking.
>> Basically, it's a data preparation area table where the records
[sic] are imported with no error check, and then validated against a
set of conditions. <<
This is usually done with an ETL tool these days, but you can do this
with a few statements. If you have an implementation of the new SQL-99
MERGE statement, then you can probably do it in one statement. It will
be a very complex statement, tho :)
BEGIN
UPDATE RawData
SET <column edits>;
DELETE GoodStuff
WHERE EXISTS
(SELECT *
FROM RawData
WHERE <<conditions>>;
INSERT INTO GoodStuff
SELECT a, b, c, ..
FROM RawData
WHERE <<conditions>>;
END;
First scrub the raw data, then remove the old data that is going to be
replaced, and finally insert the new clean data.|||moco (makelovenotspamdaldegan@.email.it) writes:
> thanks for prompt response. I understand the process is somehow
> reversed from a row-by-row cycle. It seems to me somehow inefficient,
> though, to run a query against a third table twice in order to UPDATE
> the first time and DELETE the second.
And with a loop there will be many queries against the table.
But as they say, seeing is believing. Go ahead and bench-mark. You will
be amazed...
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp