Showing posts with label exist. Show all posts
Showing posts with label exist. Show all posts

Sunday, March 11, 2012

"SQL Server does not exist or access denied." after installing XP SP2

Hi!

I just installed Windows XP Service Pack 2 on my pc and I cannot make my asp.net applications access any database any more.

I tried starting the application up from the debugger in vs.net, but I got the same behaviour: I can open the login page but as soon as the application tries to connect to SQLServer I get the "SQL Server does not exist or access denied." error message.

I'm trying to connect with trusted_connection.

Can you guys help me out?Try this Microsoft KB article:

http://support.microsoft.com/default.aspx?kbid=839269|||Hi TechMickey,

Did you find a solution to the problem? As you remember I have the same problem and it is still not working.|||Hi bws,

no, I just removed sp2 :-(|||So you took the drastic step. I disabled the firewall but without improvement. I will do like you, get rid of the whole sp2-thing. until I see a solution.

"SQL Server does not exist or access denied", again...

I'm have that darn problem...

Here is our setup:

Remote clustered SQL Server 2000 running on a Windows Server 2003 Enterprise Edition box.

Local IIS 5.1 web server (my development box) running on Windows XP Tablet Edition.

I'm using Visual Studio.Net 2003 and using ASP.Net 1.1.4322.

I have an ASP.Net application that hits the remote SQL Server. When I'm on my development box and viewing my ASP.Net project locally via IE, the application retrieves values from the remote SQL Server with no problems. If I get onto another machine, launch IE, and then hit my development box's web server (which is running the asp.net app), I get the dreaded "SQL Server does not exist or access is denied" msg.

In my ASP.Net app, I have impersonate set to true and the website is set only to windows authentication. The remote SQL Server is set to SQL and Windows authentication.

I'm at a loss on what to do, any help would be greatly appreciated.

Thanks,

ExitusLSU

Hi,

This seems to be firewall issue.
Check it after disabling firewall.
http://bhatiaworld.blogspot.com/2005/12/dot-net-error-aspnet-website-or-web.html|||

I also forgot to mention my connection string. It is:

"Data Source=<server name>;Integrated Security=SSPI;Initial Catalog=<database name>"

I've tried using the IP address, but that didn't work.

Thanks,

ExitusLSU

"SQL Server does not exist or access denied" PPC

Hi everybody,
I have a great problem with Sql Server connections in Pocket Pc. When I try
to create a connection with an Sql Server 2000 with Visual Basic.NET 2003 (I
have Windows XP), I receive the error : "SQL Server does not exist or access
denied".
My connection string is something like:
Dim conn as new Sqlconnection("Server=NAMESERVER;Initial Catalog=Aname;User
ID=anID;Password=Apwd")
I've tried to make changes like Server=192.168.1..10 or change the user and
the password, or include the Integrated Security=SSPI with no success.
Could you help me, please?
I have found the solution by myself:
in the connection string, change the server name by his IP. Then
go to "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\SVRNETCN.exe"
and then enable TCP/IP (put TCP/IP in the right square).
Accept changes... Voil!
"Antonio Prados" <antonio.prados@.eutisoftware.com> escribi en el mensaje
news:35bsm3F4iukicU1@.individual.net...
> Hi everybody,
> I have a great problem with Sql Server connections in Pocket Pc. When I
try
> to create a connection with an Sql Server 2000 with Visual Basic.NET 2003
(I
> have Windows XP), I receive the error : "SQL Server does not exist or
access
> denied".
> My connection string is something like:
> Dim conn as new Sqlconnection("Server=NAMESERVER;Initial
Catalog=Aname;User
> ID=anID;Password=Apwd")
> I've tried to make changes like Server=192.168.1..10 or change the user
and
> the password, or include the Integrated Security=SSPI with no success.
> Could you help me, please?
>

"SQL Server does not exist or access denied" PPC

Hi everybody,
I have a great problem with Sql Server connections in Pocket Pc. When I try
to create a connection with an Sql Server 2000 with Visual Basic.NET 2003 (I
have Windows XP), I receive the error : "SQL Server does not exist or access
denied".
My connection string is something like:
Dim conn as new Sqlconnection("Server=NAMESERVER;Initial Catalog=Aname;User
ID=anID;Password=Apwd")
I've tried to make changes like Server=192.168.1..10 or change the user and
the password, or include the Integrated Security=SSPI with no success.
Could you help me, please?I have found the solution by myself:
in the connection string, change the server name by his IP. Then
go to "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\SVRNETCN.exe"
and then enable TCP/IP (put TCP/IP in the right square).
Accept changes... Voil!
"Antonio Prados" <antonio.prados@.eutisoftware.com> escribi en el mensaje
news:35bsm3F4iukicU1@.individual.net...
> Hi everybody,
> I have a great problem with Sql Server connections in Pocket Pc. When I
try
> to create a connection with an Sql Server 2000 with Visual Basic.NET 2003
(I
> have Windows XP), I receive the error : "SQL Server does not exist or
access
> denied".
> My connection string is something like:
> Dim conn as new Sqlconnection("Server=NAMESERVER;Initial
Catalog=Aname;User
> ID=anID;Password=Apwd")
> I've tried to make changes like Server=192.168.1..10 or change the user
and
> the password, or include the Integrated Security=SSPI with no success.
> Could you help me, please?
>

"SQL Server does not exist or access denied" error when trying to connect from a Windows S

Hi!

I understand that this topic is one of the most discussed topics ever. However i could not find the relevant information after going through (almost) all the posts so far. Hence this post.


I am getting the 'SQL Server does not exist or access denied' error when I am trying to access SQL Server from a WINDOWS SERVICE. SQL Server and the Windows service are running on two different machines. (When they are on the same machine, it works). All the solutions I found so far are related to web apps. What should I do in the case of a windows service? My connection string uses SQL server authentication. (I tried with windows authentication. Its not working either.). Under what login does windows services run and how can I add it to valid SQL server logins?

what version of sql server you are using SQL 2000 or SQL 2005. If sql 2005 have you enabled remote connection on sql server|||I am using SQL Server 2000. My Connection String is "Data Source=Proficio3;Initial Catalog=PRO-TMS_2.5;User ID=service_login;Password=service"|||

Hi,

Please try to check if the SQL Server you're connecting to is the default instance on that server. If not, you will need to add instance name after the server name like:

Data Source=Proficio3\SQLInstance

"SQL Server does not exist or access denied" error message

Hello!

When I start my .aspx with ASP.NET Web Matrix Server, it work, but when i try to start it with IIS I get error message.

TIA,

Misha

What is your connection string to the database like? Are you using a trusted connection? Is IIS running under a different account than Web Matrix? SQL Server needs to know about which accounts are acceptable.

|||string ConnectionString = "server=SERVER;database=pubs;trusted_connection=true";
SQL is on server PC, Web Matrix on Workstation.

"SQL Server does not exist or access denied" error

I'm trying to create to set up connection between my web application on the server and
the database on another box and getting "SQL Server does not exist or access denied" error.
Both the web server and the database machine are Windows 2003 Server, there's no firewall
enabled, there's mixed authentication enabled on the sql server. The machines are not on the
same domain so I'm using SQL Server authentication from web.config. Here's my connection string:
<add key="ConnectionString" value="Server=sqlboxip;User id=sqlaccountname;Pwd=sqlpass;Initial catalog=dbname">
I've also got <identity impersonate="true"> set in web.config.
Had it the connection working at some stage but then with more tweaking and app reinstall
back square one... Please help!</identity></add>Hi,
Are you able to connect to the SQL Server Database using the same credentials from SQL Server (Enterprise Manager or Query Analyzer?)
Thanks.|||Yes, I can connect to it from my dev box in ASP.NET
|||Did you set the connection string of your connection on that page of the app?

I put this in the page load.
this.cnMainConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionsString"].ToString();

|||Hi,
Ok, can you post the code which you are trying to execute.
Thanks.

"SQL Server does not exist or access denied"

Hi everyone!

I receive error "SQL Server does not exist or access denied" when I try to run a web application from my notebook. (when I'm working at home) The weird thing is that it occurs sporadically. Sometimes the connection works just fine. Other times it fails. When I run the application on my workstation at the office everything works perfectly.

Here's the stack trace:

[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +484
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
Torris.Common.Data.GetDataSet(String ConnectionString, String sql) in c:\_\Manager\common\data.cs:14
Torris.Manager.Sizes.ListSizes() in C:\_\Manager\Sizes.ascx.cs:145
Torris.Manager.Sizes.Page_Load(Object sender, EventArgs e) in C:\_\Manager\Sizes.ascx.cs:77
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Page.ProcessRequestMain() +731

-----------------

Of course, I make sure to change the connection strings in both environments.

Anyone have an idea of what I can look at to try to troubleshoot?

Thanks as always!!

Emi ^_^Hi Emi,

This is virtually always an access issue. How are you trying to connect to the db? IOW, what is your connection string? Are you sure your laptop is setup properly?

The other thing that strikes me is connection pooling. Do you do anything with pooling--change defaults, etc.--in the app?

Don|||Hi!

Thanks for responding. Still having the issue - it's so frustrating. I'm storing my connection string in the web.config which is then read and used in my Data.cs (database class)

Here's the connection string. In this case, the database is on the same machine as the web application. (similar to the how the client's production server is setup):


<add key="ConnectionString" value="server=MyComputerName;database=DatabaseName;uid=sa;pwd=NonBlankPassword;" />

An example of the actual data access - nothing complex here.


public static void ExecuteSql(string ConnectionString, string sql)
{
SqlConnection conn = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand(sql,conn);
conn.Open();
cmd.ExecuteNonQuery();
cmd.Dispose();
conn.Close();
conn.Dispose();
}

Like I mentioned before, all works great on my workstation at the office. This might totally be a hardware - issue. Is there anything wrong with the above code that would cause any pooling problems.

Thanks again!

Emi ^_^|||Hi Emi,

Okay, assuming that your sa password in the actual connection string is right, everything else looks okay.

One thing to check is whether the SS2K server is set up to use SQL Server authentication rather than Windows integrated authentication only. You can do that in Enterprise Manager, right-clicking on the server, and selecting Properties. Under the Security tab make sure that "SQL Server and Windows" is selected.

Sigh. But never mind about that. This doesn't explain the sporadic nature of the error. There is something going on with the connection pool. You're not doing anything with the connection pool in your code, but it has a problem when it goes to the pool for a connection. Hmm. And it's happening deep within the .NET framework.

Have you monitored the pool to make sure that connections are still available? It's a weird error to get for a depleted pool, though.

This will take more research. Anyone else have any ideas?

Don

"Sql server does not exist or access denied"

Hello,

I am walking step y step with this tour:

http://www.asp.net/webmatrix/tour/section2/createnewdb.aspx

But when I came to this step:

http://www.asp.net/webmatrix/tour/section2/image/22_EnterDbName.jpg

I got the fallowing error message:

Could not create the database.

Sql server does not exist or access denied ConnectionOpen (Connect()).

I just installed:

http://www.asp.net/msde/default.aspx?tabindex=0&tabid=1

Your help is greatly appreciated.that error is based on the connection string. where's the sql server/msde, and are you using the right login info?

by the way, the angrycoder might be offended you took his name.|||As I mentioned I am using WebMatrix.

- I guess If the name was token I weren't be able to register it! :D|||when you set up your msde/sql server, did you allow for sa passwords? or did you use nt security?|||Never mind... I merly had to reboot my machine!

"Server does not exist or access is denied"

Hi,
I am trying to connect a web service to an SQL Server 2000 database. SQL
Server is installed and started and the database appears on the Enterprise
MAnager window but it does not appear in the Server Explorer in VS2003.NET
IDE window.It gives the error "Server does not exist or access is denied".
I have re-installed both SQL server and VS but have not being able to solve
this problem.
Can someone help me out ? A prompt reply will be highly appreciated.
Regards
Kapila
Where is the Server Explorer installed? Is it on a different machine or
different network? Based on the error message, it looks like the Server
Explorer is unable to find your SQL Server on the network. A network issue
is more likey to be the case. Can you ping the SQL Server computer from the
Server Explorer box?
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
SERVER EXPL@.discussions.microsoft.com> wrote in message
news:B122F925-40E5-4CFA-AA57-279E47242E4F@.microsoft.com...
> Hi,
> I am trying to connect a web service to an SQL Server 2000 database. SQL
> Server is installed and started and the database appears on the Enterprise
> MAnager window but it does not appear in the Server Explorer in VS2003.NET
> IDE window.It gives the error "Server does not exist or access is denied".
> I have re-installed both SQL server and VS but have not being able to
solve
> this problem.
> Can someone help me out ? A prompt reply will be highly appreciated.
> Regards
> Kapila
|||The server explorer is installed on the same system. I am not on a network.
The services are running.
Thanks
Kapila
"Narayana Vyas Kondreddi" wrote:

> Where is the Server Explorer installed? Is it on a different machine or
> different network? Based on the error message, it looks like the Server
> Explorer is unable to find your SQL Server on the network. A network issue
> is more likey to be the case. Can you ping the SQL Server computer from the
> Server Explorer box?
> --
> Vyas, MVP (SQL Server)
> SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
>
> "CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
> SERVER EXPL@.discussions.microsoft.com> wrote in message
> news:B122F925-40E5-4CFA-AA57-279E47242E4F@.microsoft.com...
> solve
>
>

"Server does not exist or access is denied"

Hi,
I am trying to connect a web service to an SQL Server 2000 database. SQL
Server is installed and started and the database appears on the Enterprise
MAnager window but it does not appear in the Server Explorer in VS2003.NET
IDE window.It gives the error "Server does not exist or access is denied".
I have re-installed both SQL server and VS but have not being able to solve
this problem.
Can someone help me out ? A prompt reply will be highly appreciated.
Regards
Kapila
Is the SQL Server running?
HTH
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
SERVER EXPL@.discussions.microsoft.com> wrote in message
news:61B0D79D-A657-4D25-AC9C-69349C3286B3@.microsoft.com...
> Hi,
> I am trying to connect a web service to an SQL Server 2000 database. SQL
> Server is installed and started and the database appears on the Enterprise
> MAnager window but it does not appear in the Server Explorer in VS2003.NET
> IDE window.It gives the error "Server does not exist or access is denied".
> I have re-installed both SQL server and VS but have not being able to
> solve
> this problem.
> Can someone help me out ? A prompt reply will be highly appreciated.
> Regards
> Kapila
|||Yes, it does. It is shown on the status bar and also in Services. However, it
is not appearing in the computer management console of MS Server 2003.
Best wishes.
Kapila
"Kalen Delaney" wrote:

> Is the SQL Server running?
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
> SERVER EXPL@.discussions.microsoft.com> wrote in message
> news:61B0D79D-A657-4D25-AC9C-69349C3286B3@.microsoft.com...
>
>
|||It is possible for the SQL Enterprise or iSQL applications to see and work
with SQL server instances while other non-SQL tools such as VS.Net may not
see your SQL servers at all. (based on your problem description)
1. Check to see how the SQL Security is configured on the server. The best
practice is to configure it with Windows Integrated.
2. I always configure SQL Server with Mixed modes (W and Sql). Reason: My
developer PC may not always log on to the Windows Server/Domain where my SQL
Instance is hosted. If such condition exists, then SQL Authentication mode
kicks in to allow me to log on to it.
3. Another suggestion is that if your server is not in the DNS system, then
it is safe to put it in your Windows/HOSTS file. This way everybody
(applications) on your PC can see it.
John Webb

"Server does not exist or access is denied"

Hi,
I am trying to connect a web service to an SQL Server 2000 database. SQL
Server is installed and started and the database appears on the Enterprise
MAnager window but it does not appear in the Server Explorer in VS2003.NET
IDE window.It gives the error "Server does not exist or access is denied".
I have re-installed both SQL server and VS but have not being able to solve
this problem.
Can someone help me out ? A prompt reply will be highly appreciated.
Regards
KapilaIs the SQL Server running?
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
SERVER EXPL@.discussions.microsoft.com> wrote in message
news:61B0D79D-A657-4D25-AC9C-69349C3286B3@.microsoft.com...
> Hi,
> I am trying to connect a web service to an SQL Server 2000 database. SQL
> Server is installed and started and the database appears on the Enterprise
> MAnager window but it does not appear in the Server Explorer in VS2003.NET
> IDE window.It gives the error "Server does not exist or access is denied".
> I have re-installed both SQL server and VS but have not being able to
> solve
> this problem.
> Can someone help me out ? A prompt reply will be highly appreciated.
> Regards
> Kapila|||Yes, it does. It is shown on the status bar and also in Services. However, i
t
is not appearing in the computer management console of MS Server 2003.
Best wishes.
Kapila
"Kalen Delaney" wrote:

> Is the SQL Server running?
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
> SERVER EXPL@.discussions.microsoft.com> wrote in message
> news:61B0D79D-A657-4D25-AC9C-69349C3286B3@.microsoft.com...
>
>|||It is possible for the SQL Enterprise or iSQL applications to see and work
with SQL server instances while other non-SQL tools such as VS.Net may not
see your SQL servers at all. (based on your problem description)
1. Check to see how the SQL Security is configured on the server. The best
practice is to configure it with Windows Integrated.
2. I always configure SQL Server with Mixed modes (W and Sql). Reason: My
developer PC may not always log on to the Windows Server/Domain where my SQL
Instance is hosted. If such condition exists, then SQL Authentication mode
kicks in to allow me to log on to it.
3. Another suggestion is that if your server is not in the DNS system, then
it is safe to put it in your Windows/HOSTS file. This way everybody
(applications) on your PC can see it.
John Webb

"Server does not exist or access is denied"

Hi,
I am trying to connect a web service to an SQL Server 2000 database. SQL
Server is installed and started and the database appears on the Enterprise
MAnager window but it does not appear in the Server Explorer in VS2003.NET
IDE window.It gives the error "Server does not exist or access is denied".
I have re-installed both SQL server and VS but have not being able to solve
this problem.
Can someone help me out ? A prompt reply will be highly appreciated.
Regards
KapilaWhere is the Server Explorer installed? Is it on a different machine or
different network? Based on the error message, it looks like the Server
Explorer is unable to find your SQL Server on the network. A network issue
is more likey to be the case. Can you ping the SQL Server computer from the
Server Explorer box?
--
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
SERVER EXPL@.discussions.microsoft.com> wrote in message
news:B122F925-40E5-4CFA-AA57-279E47242E4F@.microsoft.com...
> Hi,
> I am trying to connect a web service to an SQL Server 2000 database. SQL
> Server is installed and started and the database appears on the Enterprise
> MAnager window but it does not appear in the Server Explorer in VS2003.NET
> IDE window.It gives the error "Server does not exist or access is denied".
> I have re-installed both SQL server and VS but have not being able to
solve
> this problem.
> Can someone help me out ? A prompt reply will be highly appreciated.
> Regards
> Kapila|||The server explorer is installed on the same system. I am not on a network.
The services are running.
Thanks
Kapila
"Narayana Vyas Kondreddi" wrote:

> Where is the Server Explorer installed? Is it on a different machine or
> different network? Based on the error message, it looks like the Server
> Explorer is unable to find your SQL Server on the network. A network issue
> is more likey to be the case. Can you ping the SQL Server computer from th
e
> Server Explorer box?
> --
> Vyas, MVP (SQL Server)
> SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
>
> "CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
> SERVER EXPL@.discussions.microsoft.com> wrote in message
> news:B122F925-40E5-4CFA-AA57-279E47242E4F@.microsoft.com...
> solve
>
>

"Server does not exist or access is denied"

Hi,
I am trying to connect a web service to an SQL Server 2000 database. SQL
Server is installed and started and the database appears on the Enterprise
MAnager window but it does not appear in the Server Explorer in VS2003.NET
IDE window.It gives the error "Server does not exist or access is denied".
I have re-installed both SQL server and VS but have not being able to solve
this problem.
Can someone help me out ? A prompt reply will be highly appreciated.
Regards
KapilaWhere is the Server Explorer installed? Is it on a different machine or
different network? Based on the error message, it looks like the Server
Explorer is unable to find your SQL Server on the network. A network issue
is more likey to be the case. Can you ping the SQL Server computer from the
Server Explorer box?
--
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
SERVER EXPL@.discussions.microsoft.com> wrote in message
news:B122F925-40E5-4CFA-AA57-279E47242E4F@.microsoft.com...
> Hi,
> I am trying to connect a web service to an SQL Server 2000 database. SQL
> Server is installed and started and the database appears on the Enterprise
> MAnager window but it does not appear in the Server Explorer in VS2003.NET
> IDE window.It gives the error "Server does not exist or access is denied".
> I have re-installed both SQL server and VS but have not being able to
solve
> this problem.
> Can someone help me out ? A prompt reply will be highly appreciated.
> Regards
> Kapila|||The server explorer is installed on the same system. I am not on a network.
The services are running.
Thanks
Kapila
"Narayana Vyas Kondreddi" wrote:
> Where is the Server Explorer installed? Is it on a different machine or
> different network? Based on the error message, it looks like the Server
> Explorer is unable to find your SQL Server on the network. A network issue
> is more likey to be the case. Can you ping the SQL Server computer from the
> Server Explorer box?
> --
> Vyas, MVP (SQL Server)
> SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
>
> "CAN'T SEE THE SERVER FROM VS SERVER EXPL" <CAN'T SEE THE SERVER FROM VS
> SERVER EXPL@.discussions.microsoft.com> wrote in message
> news:B122F925-40E5-4CFA-AA57-279E47242E4F@.microsoft.com...
> > Hi,
> >
> > I am trying to connect a web service to an SQL Server 2000 database. SQL
> > Server is installed and started and the database appears on the Enterprise
> > MAnager window but it does not appear in the Server Explorer in VS2003.NET
> > IDE window.It gives the error "Server does not exist or access is denied".
> >
> > I have re-installed both SQL server and VS but have not being able to
> solve
> > this problem.
> >
> > Can someone help me out ? A prompt reply will be highly appreciated.
> >
> > Regards
> >
> > Kapila
>
>

Thursday, February 16, 2012

"for" loop

hello

Does exist in SQL language "for" loop ? If yes, what syntax does it has ?

best wishes
AdamNo - see WHILE and "Cursors" in Books Online. But in SQL, a loop is
often not a good solution - people may use them when they should use a
single, set-based statement such as UPDATE or DELETE.

Of course, there are times when a while or cursor loop is the best
solution, so you might have a good reason to do this - if you can give
more details of what you need to achieve, someone may be able to
comment on whether a loop is appropriate for you or not.

Simon|||Mostly it pays to find a set based solution rather than write loops. If
you need to loop then TSQL has WHILE.

--
David Portas
SQL Server MVP
--|||I try to substitute "for" loop by this excample:

declare @.i int
while (@.i<10)
begin
insert into dbname.dbo.table_name values @.i
@.i=@.i+1
end

but in line @.i=@.i+1 ocured an error. Why ?
I know - it is stupid reason to use "for" loop , but what shoul I changed to
work this example ?
What are better ways to do such task ?|||A common solution is to keep a table of numbers in your database
(single column of numbers from 0 to some very large number). This can
help avoid loops in many places:

INSERT INTO table_name (...)
SELECT num, ...
FROM Numbers
WHERE num BETWEEN 1 AND 10

Of course you'll still probably use a loop to populate the Numbers
table, but that only has to be done once and at install time, not at
runtime.

--
David Portas
SQL Server MVP
--|||Numbers table:

CREATE TABLE numbers (num INTEGER NOT NULL CONSTRAINT pk_numbers
PRIMARY KEY) ;

INSERT INTO numbers (num) VALUES (0) ;

WHILE (SELECT MAX(num) FROM numbers)<65535
INSERT INTO numbers
SELECT num+(SELECT MAX(num)+1 FROM numbers)
FROM numbers ;

--
David Portas
SQL Server MVP
--|||As David suggested, a numbers table is definitely a useful tool:

http://www.aspfaq.com/show.asp?id=2516

A calendar table is another good one:

http://www.aspfaq.com/show.asp?id=2519

Simon|||Hi David,
We can do this simple trick

Select identity(int,1,1) MyId into MyTable from
anySystemTable,anySystemTable,anySystemTable ......

With warm regards
Jatinder Singh|||adam (ereuseen@.wp.pl) writes:
> I try to substitute "for" loop by this excample:
> declare @.i int
> while (@.i<10)
> begin
> insert into dbname.dbo.table_name values @.i
> @.i=@.i+1
> end
> but in line @.i=@.i+1 ocured an error. Why ?

You need to say SET or SELECT in front. I prefer SELECT, as you can assign
more that one variable in one bang:

SELECT @.a = 1, @.b = @.c + d, @.t = NULL

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Here is a way to gemerate the Sequence table without proprietary code
and create the rows in parallel instead of one at a time.

WITH
(SELECT 0
UNION ALL
SELECT 1
..
UNION ALL
SELECT 9) AS Digits(digit)
SELECT D1.digit + 10*D2.digit + 100*D3.digit + 1000*D4.digit + ..
FROM Digits AS D1, Digits AS D2, Digits AS D3, Digits AS D4, ..
WHERE (D1.digit + D2.digit + D3.digit + D4.digit + ..) > 0;

IDENTITY has be done one at a time, while this can be parallelized and
can generate numbers in sets. The CTE can be repalced with a TABLE or
VIEW.

Friday, January 27, 2012

"[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access deni

hi all,

this is punya,

and i am having a problem which was encountered by youin the past. My actual proble is " I am having vs.net 2005 along with MS SQL Server 2000 (Server1) in my system. The MS SQL Server is database server for some of my collegues. Whenever i want to connect to my Server1 DBServer it is givng the following error message."

"[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied"

and the other guys are able to connect to the same DBServer. and one thing i am able to connect to other DBServers which are in Lan..

please Help me.what does the connection string look like? windows or sql auth?

some samples here: http://www.connectionstrings.com