Monday, March 19, 2012
Error in sample Northwind?
contain any spaces for if they did I had to write my "SQL" statements a =
little differently.
I was following an exmple and had a SQL statment:
sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with =
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the Northwind database in SQL 2000 it is =
shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. =
So what I am wondering is when tables in SQL 2000 contain spaces like =
the above Order Deatails, is the SQL statement as I have written it =
irrelevant? Shouldn't it be:
sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2"
?
Thanks.
--=20
George Hester
__________________________________
Hi,
Use SQARE brackets [] incase if you have space inbetwen the object names.
sSQL1 = "UPDATE [Order Details] SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
Thanks
Hari
MCDBA
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:e#lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not
contain any spaces for if they did I had to write my "SQL" statements a
little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the Northwind database in SQL 2000 it is shown as
Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables in SQL 2000 contain spaces like the above
Order Deatails, is the SQL statement as I have written it irrelevant?
Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
?
Thanks.
George Hester
__________________________________
|||The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
brackets. I prefer the ANSI SQL Compliant way.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
had to write my "SQL" statements a little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
Northwind database in SQL 2000 it is shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So what I am wondering is when tables
in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
irrelevant? Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
?
Thanks.
George Hester
__________________________________
|||OK then it would be:
sSQL1 =3D "UPDATE ""Order Details"" SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
for VBScript?
--=20
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote =
in message news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside =
double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
>=20
> --=20
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>=20
>=20
> "George Hester" <hesterloli@.hotmail.com> wrote in message =
news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not =
contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
>=20
> I was following an exmple and had a SQL statment:
>=20
> sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
>=20
> Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the =
space.
>=20
> This is the only table in the Northwind database that conatins a =
space. So what I am wondering is when tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL =
statement as I have written it
> irrelevant? Shouldn't it be:
>=20
> sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
> ?
> Thanks.
>=20
> --=20
> George Hester
> __________________________________
>=20
>
|||Yep. Better yet, always quality the object name with the owner. :-)
UPDATE dbo."Order Details" SET...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:ujt2XRFQEHA.3220@.TK2MSFTNGP09.phx.gbl...
OK then it would be:
sSQL1 = "UPDATE ""Order Details"" SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
for VBScript?
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> I was following an exmple and had a SQL statment:
> sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the space.
> This is the only table in the Northwind database that conatins a space. So what I am wondering is when
tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
> irrelevant? Shouldn't it be:
> sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
> ?
> Thanks.
> --
> George Hester
> __________________________________
>
Error in sample Northwind?
I was following an exmple and had a SQL statment:
sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND = ProductID=3D2" This is in ASP with = Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. = But if you go to the tables in the Northwind database in SQL 2000 it is = shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. = So what I am wondering is when tables in SQL 2000 contain spaces like = the above Order Deatails, is the SQL statement as I have written it = irrelevant? Shouldn't it be:
sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 AND = ProductID=3D2"
?
Thanks.
-- George Hester
__________________________________Hi,
Use SQARE brackets [] incase if you have space inbetwen the object names.
sSQL1 = "UPDATE [Order Details] SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
Thanks
Hari
MCDBA
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:e#lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not
contain any spaces for if they did I had to write my "SQL" statements a
little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the Northwind database in SQL 2000 it is shown as
Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables in SQL 2000 contain spaces like the above
Order Deatails, is the SQL statement as I have written it irrelevant?
Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
?
Thanks.
--
George Hester
__________________________________|||The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
brackets. I prefer the ANSI SQL Compliant way.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
had to write my "SQL" statements a little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
Northwind database in SQL 2000 it is shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So what I am wondering is when tables
in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
irrelevant? Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
?
Thanks.
--
George Hester
__________________________________|||OK then it would be:
sSQL1 =3D "UPDATE ""Order Details"" SET Quantity=3D5 WHERE OrderID=3D3 =AND ProductID=3D2"
for VBScript?
-- George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote =in message news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside =double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> > -- > Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> > > "George Hester" <hesterloli@.hotmail.com> wrote in message =news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not =contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> > I was following an exmple and had a SQL statment:
> > sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =ProductID=3D2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> > Anyway if you look at this statement the table is called OrderDetails. = But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the =space.
> > This is the only table in the Northwind database that conatins a =space. So what I am wondering is when tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL =statement as I have written it
> irrelevant? Shouldn't it be:
> > sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 =AND ProductID=3D2"
> ?
> Thanks.
> > -- > George Hester
> __________________________________
> >|||Yep. Better yet, always quality the object name with the owner. :-)
UPDATE dbo."Order Details" SET...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:ujt2XRFQEHA.3220@.TK2MSFTNGP09.phx.gbl...
OK then it would be:
sSQL1 = "UPDATE ""Order Details"" SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
for VBScript?
--
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> I was following an exmple and had a SQL statment:
> sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the space.
> This is the only table in the Northwind database that conatins a space. So what I am wondering is when
tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
> irrelevant? Shouldn't it be:
> sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
> ?
> Thanks.
> --
> George Hester
> __________________________________
>
Error in sample Northwind?
contain any spaces for if they did I had to write my "SQL" statements a =
little differently.
I was following an exmple and had a SQL statment:
sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with =
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the Northwind database in SQL 2000 it is =
shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. =
So what I am wondering is when tables in SQL 2000 contain spaces like =
the above Order Deatails, is the SQL statement as I have written it =
irrelevant? Shouldn't it be:
sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2"
?
Thanks.
--=20
George Hester
__________________________________Hi,
Use SQARE brackets [] incase if you have space inbetwen the object names
.
sSQL1 = "UPDATE [Order Details] SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
Thanks
Hari
MCDBA
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:e#lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not
contain any spaces for if they did I had to write my "SQL" statements a
little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the Northwind database in SQL 2000 it is shown as
Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables in SQL 2000 contain spaces like the above
Order Deatails, is the SQL statement as I have written it irrelevant?
Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
?
Thanks.
George Hester
__________________________________|||The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL
Server also support square
brackets. I prefer the ANSI SQL Compliant way.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA
.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not conta
in any spaces for if they did I
had to write my "SQL" statements a little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the
Northwind database in SQL 2000 it is shown as Order Details. Note the space
.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables
in SQL 2000 contain spaces like the above Order Deatails, is the SQL stateme
nt as I have written it
irrelevant? Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID
=2"
?
Thanks.
George Hester
__________________________________|||OK then it would be:
sSQL1 =3D "UPDATE ""Order Details"" SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
for VBScript?
--=20
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote =
in message news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside =
double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
>=20
> --=20
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>=20
>=20
> "George Hester" <hesterloli@.hotmail.com> wrote in message =
news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not =
contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
>=20
> I was following an exmple and had a SQL statment:
>=20
> sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
>=20
> Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the =
space.
>=20
> This is the only table in the Northwind database that conatins a =
space. So what I am wondering is when tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL =
statement as I have written it
> irrelevant? Shouldn't it be:
>=20
> sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
> ?
> Thanks.
>=20
> --=20
> George Hester
> __________________________________
>=20
>|||Yep. Better yet, always quality the object name with the owner. :-)
UPDATE dbo."Order Details" SET...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:ujt2XRFQEHA.3
220@.TK2MSFTNGP09.phx.gbl...
OK then it would be:
sSQL1 = "UPDATE ""Order Details"" SET Quantity=5 WHERE OrderID=3 AND Product
ID=2"
for VBScript?
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message
news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside double-quotes. SQ
L Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPE
HA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not con
tain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> I was following an exmple and had a SQL statment:
> sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=
2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> Anyway if you look at this statement the table is called OrderDetails. Bu
t if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the spa
ce.
> This is the only table in the Northwind database that conatins a space. So what I
am wondering is when
tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL state
ment as I have written it
> irrelevant? Shouldn't it be:
> sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND Product
ID=2"
> ?
> Thanks.
> --
> George Hester
> __________________________________
>
Sunday, February 26, 2012
Error in database mirroring
Hi,
when I tried to mirror database giving principal and mirror server names every details I am getting the error
'Database mirroring is disabled by default. Database mirroring is currently provided for evaluation purposes only and is not to be used in production environments.To enable database mirroring for evaluation purposes, use trace flag 1400 during startup.'
How to user trace flag 1400 during startup?
Since I am newbie Kindly guide me with step by step procedure.
thanks
Hi Shobha,
Database Mirroring is disabled by default in SQL Server 2005 and is enabled in SQL Server 2005 SP1. Therefore, I strongly encourage you to download and install SP1 by following the directions at https://www.microsoft.com/sql/sp1.mspx.
However, if you choose to continue using the RTM (Release to Manufacturer) version of SQL Server 2005 you can enable this feature by adding -T 1400 to the startup options. To do this follow the direction at http://msdn2.microsoft.com/en-us/library/ms190737.aspx. You will need to restart the service upon doing this; a reboot of your system should suffice.
Thanks,
Jaaved Mohammed
|||Hi. I am using SP1 currently, but I still got the same problem
Error in database mirroring
Hi,
when I tried to mirror database giving principal and mirror server names every details I am getting the error
'Database mirroring is disabled by default. Database mirroring is currently provided for evaluation purposes only and is not to be used in production environments.To enable database mirroring for evaluation purposes, use trace flag 1400 during startup.'
How to user trace flag 1400 during startup?
Since I am newbie Kindly guide me with step by step procedure.
thanks
Hi Shobha,
Database Mirroring is disabled by default in SQL Server 2005 and is enabled in SQL Server 2005 SP1. Therefore, I strongly encourage you to download and install SP1 by following the directions at https://www.microsoft.com/sql/sp1.mspx.
However, if you choose to continue using the RTM (Release to Manufacturer) version of SQL Server 2005 you can enable this feature by adding -T 1400 to the startup options. To do this follow the direction at http://msdn2.microsoft.com/en-us/library/ms190737.aspx. You will need to restart the service upon doing this; a reboot of your system should suffice.
Thanks,
Jaaved Mohammed
|||Hi. I am using SP1 currently, but I still got the same problem
Wednesday, February 15, 2012
Error handling in sql server
I have a job looping through a table containing names of databases. Based
on some criterias I want to detach some of the databases.
So far all is good.
If for some reason the detach fails, the job fails and quits.
I would like to know if I in any way can get the job to continue the loop
without aborting the job?
Today the log can look like:
Detached database p2419983 [SQLSTATE 01000] - detached ok
Msg 15010, Sev 16: The database 'p2489947' does not exist. Use sp_helpdb
to show available databases. [SQLSTATE 42000] - failed to detach
I am aware that I should solve the real problem here (database does not
exist), but I would like to know anyway...
Any help will be appreciated.
Thanks,Hi Gurba,
Some really good article about that can be found here:
http://www.sommarskog.se/error-handling-I.html
HTH, jens Suessmeyer.|||If a function does not exist, then the db_id() function will return NULL.
For example:
if db_id(@.dbname) is not null
begin
. . .
. . .
end
"Gurba" <gurbao@.hotmail.com> wrote in message
news:Xns97097A4DAA9F6gurbaohotmailcom@.12
9.250.171.65...
> Hi,
> I have a job looping through a table containing names of databases. Based
> on some criterias I want to detach some of the databases.
> So far all is good.
> If for some reason the detach fails, the job fails and quits.
> I would like to know if I in any way can get the job to continue the loop
> without aborting the job?
> Today the log can look like:
> Detached database p2419983 [SQLSTATE 01000] - detached ok
> Msg 15010, Sev 16: The database 'p2489947' does not exist. Use sp_helpdb
> to show available databases. [SQLSTATE 42000] - failed to detach
> I am aware that I should solve the real problem here (database does not
> exist), but I would like to know anyway...
> Any help will be appreciated.
> Thanks,