Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Tuesday, March 27, 2012

backing up remote database

when I try to schedule a backup, or just do a backup, of a remote database
I get this error message:
"database 'msdb' cannot be opened. It has been marked SUSPECT by recovery."
I can connect to the database and view it.
I checked the error logs and there is no information about this error
listed.
I googled the error but did not find any solutions
Any insights to this error message ?
Answered in .programming
Please don't multi-post.
Regards
Mike
"TJS" wrote:

> when I try to schedule a backup, or just do a backup, of a remote database
> I get this error message:
> "database 'msdb' cannot be opened. It has been marked SUSPECT by recovery."
> I can connect to the database and view it.
> I checked the error logs and there is no information about this error
> listed.
> I googled the error but did not find any solutions
> Any insights to this error message ?
>
>

Sunday, March 25, 2012

Backing up log files

Hi,
I'd like to know what happens to a log file when you back it up. I received
an error that my log file had grown too much & that I should back it up,
which I did & I no longer received the error.
But what happens when you simply back up a log file? Does it also truncate
unused space or what? It obviously doesn't simply make a backup of it.
Many thanks for helping me understand what is happening here
AntBACKUP LOG will indeed empty the log file (also known as "truncate" the file). If you for some
reason don't want to do transaction log backup then set the recovery model for the database to
"simple".
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ant" <Ant@.discussions.microsoft.com> wrote in message
news:505DB4BD-BEF0-4708-BEEE-BC4088A82527@.microsoft.com...
> Hi,
> I'd like to know what happens to a log file when you back it up. I received
> an error that my log file had grown too much & that I should back it up,
> which I did & I no longer received the error.
> But what happens when you simply back up a log file? Does it also truncate
> unused space or what? It obviously doesn't simply make a backup of it.
> Many thanks for helping me understand what is happening here
> Ant|||Tibor
> BACKUP LOG will indeed empty the log file (also known as "truncate" the
> file).
I was thinking that by issuing BACKUP LOG , SQL Server is able to re-use
virtual logs file that LOG file is built by and delete only inactive
(written to disk) transaction
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:uinyn2kYIHA.3400@.TK2MSFTNGP03.phx.gbl...
> BACKUP LOG will indeed empty the log file (also known as "truncate" the
> file). If you for some reason don't want to do transaction log backup then
> set the recovery model for the database to "simple".
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Ant" <Ant@.discussions.microsoft.com> wrote in message
> news:505DB4BD-BEF0-4708-BEEE-BC4088A82527@.microsoft.com...
>> Hi,
>> I'd like to know what happens to a log file when you back it up. I
>> received
>> an error that my log file had grown too much & that I should back it up,
>> which I did & I no longer received the error.
>> But what happens when you simply back up a log file? Does it also
>> truncate
>> unused space or what? It obviously doesn't simply make a backup of it.
>> Many thanks for helping me understand what is happening here
>> Ant
>|||Hi Uri,
It all depends on what abstraction level we want to be. :-)
At a higher abstraction level, I think it suffices to say "empty the log" (or "truncate", whichever
in English gets the message through). I prefer to say "empty", since I believe it makes it clearer
that the file isn't made smaller.
There are of course much more details what happens when you BACKUP LOG. I stay away from those
details when I see a basic question and I suspect the OP has limited experience with transaction log
internals - like virtual log files. The reasoning is that more details will only cloud the message.
:-)
As for the details, this is how I believe it works. Anyone is of course free to add and correct,
below if off the top of my head:
A VLF can be in four states:
A. Never ever used
B. Used, and all log records are prior than the last checkpoint and have also been written to disk.
C. Used, but some log records are more recent than last checkpoint and/or not written to disk.
D. The active log (where the current log record, "head of the log", is).
BACKUP will not actually delete anything from the log file, it will just allow for re-use of the
virtual log file. Basically turning C above into B. A and B can be re-used (overwritten whenever the
head of the log moves to this virtual log file). These have status 0 in DBCC LOGINFO, while C and D
have status 2.
Now, above takes some thinking and some visualization in the head (or whiteboard). Which is why I
tend to stick with the higher abstraction level for basic questions. :-).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Uri Dimant" <urid@.iscar.co.il> wrote in message news:ucYuxAlYIHA.3964@.TK2MSFTNGP03.phx.gbl...
> Tibor
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the file).
> I was thinking that by issuing BACKUP LOG , SQL Server is able to re-use virtual logs file that
> LOG file is built by and delete only inactive (written to disk) transaction
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> news:uinyn2kYIHA.3400@.TK2MSFTNGP03.phx.gbl...
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the file). If you for some
>> reason don't want to do transaction log backup then set the recovery model for the database to
>> "simple".
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Ant" <Ant@.discussions.microsoft.com> wrote in message
>> news:505DB4BD-BEF0-4708-BEEE-BC4088A82527@.microsoft.com...
>> Hi,
>> I'd like to know what happens to a log file when you back it up. I received
>> an error that my log file had grown too much & that I should back it up,
>> which I did & I no longer received the error.
>> But what happens when you simply back up a log file? Does it also truncate
>> unused space or what? It obviously doesn't simply make a backup of it.
>> Many thanks for helping me understand what is happening here
>> Ant
>>
>|||Tibor
The ability to think on abstaction level given from God, I mean you canot
learn this. :-)
And you I think have it.
> BACKUP will not actually delete anything from the log file, it will just
> allow for re-use of the virtual log file
Yep, that it was my understanding as well
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:eAHQNOlYIHA.5160@.TK2MSFTNGP05.phx.gbl...
> Hi Uri,
> It all depends on what abstraction level we want to be. :-)
> At a higher abstraction level, I think it suffices to say "empty the log"
> (or "truncate", whichever in English gets the message through). I prefer
> to say "empty", since I believe it makes it clearer that the file isn't
> made smaller.
> There are of course much more details what happens when you BACKUP LOG. I
> stay away from those details when I see a basic question and I suspect the
> OP has limited experience with transaction log internals - like virtual
> log files. The reasoning is that more details will only cloud the message.
> :-)
> As for the details, this is how I believe it works. Anyone is of course
> free to add and correct, below if off the top of my head:
> A VLF can be in four states:
> A. Never ever used
> B. Used, and all log records are prior than the last checkpoint and have
> also been written to disk.
> C. Used, but some log records are more recent than last checkpoint and/or
> not written to disk.
> D. The active log (where the current log record, "head of the log", is).
> BACKUP will not actually delete anything from the log file, it will just
> allow for re-use of the virtual log file. Basically turning C above into
> B. A and B can be re-used (overwritten whenever the head of the log moves
> to this virtual log file). These have status 0 in DBCC LOGINFO, while C
> and D have status 2.
> Now, above takes some thinking and some visualization in the head (or
> whiteboard). Which is why I tend to stick with the higher abstraction
> level for basic questions. :-).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:ucYuxAlYIHA.3964@.TK2MSFTNGP03.phx.gbl...
>> Tibor
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the
>> file).
>> I was thinking that by issuing BACKUP LOG , SQL Server is able to re-use
>> virtual logs file that LOG file is built by and delete only inactive
>> (written to disk) transaction
>>
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
>> in message news:uinyn2kYIHA.3400@.TK2MSFTNGP03.phx.gbl...
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the
>> file). If you for some reason don't want to do transaction log backup
>> then set the recovery model for the database to "simple".
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Ant" <Ant@.discussions.microsoft.com> wrote in message
>> news:505DB4BD-BEF0-4708-BEEE-BC4088A82527@.microsoft.com...
>> Hi,
>> I'd like to know what happens to a log file when you back it up. I
>> received
>> an error that my log file had grown too much & that I should back it
>> up,
>> which I did & I no longer received the error.
>> But what happens when you simply back up a log file? Does it also
>> truncate
>> unused space or what? It obviously doesn't simply make a backup of it.
>> Many thanks for helping me understand what is happening here
>> Ant
>>
>>
>|||Hi Tibor
The two middle states have nothing to do with Checkpoint. The have to do
with whether those transactions have been backed up, so the log space can be
reused.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:eAHQNOlYIHA.5160@.TK2MSFTNGP05.phx.gbl...
> Hi Uri,
> It all depends on what abstraction level we want to be. :-)
> At a higher abstraction level, I think it suffices to say "empty the log"
> (or "truncate", whichever in English gets the message through). I prefer
> to say "empty", since I believe it makes it clearer that the file isn't
> made smaller.
> There are of course much more details what happens when you BACKUP LOG. I
> stay away from those details when I see a basic question and I suspect the
> OP has limited experience with transaction log internals - like virtual
> log files. The reasoning is that more details will only cloud the message.
> :-)
> As for the details, this is how I believe it works. Anyone is of course
> free to add and correct, below if off the top of my head:
> A VLF can be in four states:
> A. Never ever used
> B. Used, and all log records are prior than the last checkpoint and have
> also been written to disk.
> C. Used, but some log records are more recent than last checkpoint and/or
> not written to disk.
> D. The active log (where the current log record, "head of the log", is).
> BACKUP will not actually delete anything from the log file, it will just
> allow for re-use of the virtual log file. Basically turning C above into
> B. A and B can be re-used (overwritten whenever the head of the log moves
> to this virtual log file). These have status 0 in DBCC LOGINFO, while C
> and D have status 2.
> Now, above takes some thinking and some visualization in the head (or
> whiteboard). Which is why I tend to stick with the higher abstraction
> level for basic questions. :-).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:ucYuxAlYIHA.3964@.TK2MSFTNGP03.phx.gbl...
>> Tibor
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the
>> file).
>> I was thinking that by issuing BACKUP LOG , SQL Server is able to re-use
>> virtual logs file that LOG file is built by and delete only inactive
>> (written to disk) transaction
>>
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
>> in message news:uinyn2kYIHA.3400@.TK2MSFTNGP03.phx.gbl...
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the
>> file). If you for some reason don't want to do transaction log backup
>> then set the recovery model for the database to "simple".
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Ant" <Ant@.discussions.microsoft.com> wrote in message
>> news:505DB4BD-BEF0-4708-BEEE-BC4088A82527@.microsoft.com...
>> Hi,
>> I'd like to know what happens to a log file when you back it up. I
>> received
>> an error that my log file had grown too much & that I should back it
>> up,
>> which I did & I no longer received the error.
>> But what happens when you simply back up a log file? Does it also
>> truncate
>> unused space or what? It obviously doesn't simply make a backup of it.
>> Many thanks for helping me understand what is happening here
>> Ant
>>
>>
>|||Hi Kalen,
Thanks. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%23F5ejyrYIHA.1212@.TK2MSFTNGP05.phx.gbl...
> Hi Tibor
> The two middle states have nothing to do with Checkpoint. The have to do with whether those
> transactions have been backed up, so the log space can be reused.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.InsideSQLServer.com
> http://blog.kalendelaney.com
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> news:eAHQNOlYIHA.5160@.TK2MSFTNGP05.phx.gbl...
>> Hi Uri,
>> It all depends on what abstraction level we want to be. :-)
>> At a higher abstraction level, I think it suffices to say "empty the log" (or "truncate",
>> whichever in English gets the message through). I prefer to say "empty", since I believe it makes
>> it clearer that the file isn't made smaller.
>> There are of course much more details what happens when you BACKUP LOG. I stay away from those
>> details when I see a basic question and I suspect the OP has limited experience with transaction
>> log internals - like virtual log files. The reasoning is that more details will only cloud the
>> message. :-)
>> As for the details, this is how I believe it works. Anyone is of course free to add and correct,
>> below if off the top of my head:
>> A VLF can be in four states:
>> A. Never ever used
>> B. Used, and all log records are prior than the last checkpoint and have also been written to
>> disk.
>> C. Used, but some log records are more recent than last checkpoint and/or not written to disk.
>> D. The active log (where the current log record, "head of the log", is).
>> BACKUP will not actually delete anything from the log file, it will just allow for re-use of the
>> virtual log file. Basically turning C above into B. A and B can be re-used (overwritten whenever
>> the head of the log moves to this virtual log file). These have status 0 in DBCC LOGINFO, while C
>> and D have status 2.
>> Now, above takes some thinking and some visualization in the head (or whiteboard). Which is why I
>> tend to stick with the higher abstraction level for basic questions. :-).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message news:ucYuxAlYIHA.3964@.TK2MSFTNGP03.phx.gbl...
>> Tibor
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the file).
>> I was thinking that by issuing BACKUP LOG , SQL Server is able to re-use virtual logs file that
>> LOG file is built by and delete only inactive (written to disk) transaction
>>
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
>> news:uinyn2kYIHA.3400@.TK2MSFTNGP03.phx.gbl...
>> BACKUP LOG will indeed empty the log file (also known as "truncate" the file). If you for some
>> reason don't want to do transaction log backup then set the recovery model for the database to
>> "simple".
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Ant" <Ant@.discussions.microsoft.com> wrote in message
>> news:505DB4BD-BEF0-4708-BEEE-BC4088A82527@.microsoft.com...
>> Hi,
>> I'd like to know what happens to a log file when you back it up. I received
>> an error that my log file had grown too much & that I should back it up,
>> which I did & I no longer received the error.
>> But what happens when you simply back up a log file? Does it also truncate
>> unused space or what? It obviously doesn't simply make a backup of it.
>> Many thanks for helping me understand what is happening here
>> Ant
>>
>>
>>
>|||You're welcome.
:-)
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:eWx%23pC1YIHA.3880@.TK2MSFTNGP05.phx.gbl...
> Hi Kalen,
> Thanks. :-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:%23F5ejyrYIHA.1212@.TK2MSFTNGP05.phx.gbl...
>> Hi Tibor
>> The two middle states have nothing to do with Checkpoint. The have to do
>> with whether those transactions have been backed up, so the log space can
>> be reused.
>> --
>> HTH
>> Kalen Delaney, SQL Server MVP
>> www.InsideSQLServer.com
>> http://blog.kalendelaney.com
>>
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
>> in message news:eAHQNOlYIHA.5160@.TK2MSFTNGP05.phx.gbl...
>> Hi Uri,
>> It all depends on what abstraction level we want to be. :-)
>> At a higher abstraction level, I think it suffices to say "empty the
>> log" (or "truncate", whichever in English gets the message through). I
>> prefer to say "empty", since I believe it makes it clearer that the file
>> isn't made smaller.
>> There are of course much more details what happens when you BACKUP LOG.
>> I stay away from those details when I see a basic question and I suspect
>> the OP has limited experience with transaction log internals - like
>> virtual log files. The reasoning is that more details will only cloud
>> the message. :-)
>> As for the details, this is how I believe it works. Anyone is of course
>> free to add and correct, below if off the top of my head:
>> A VLF can be in four states:
>> A. Never ever used
>> B. Used, and all log records are prior than the last checkpoint and have
>> also been written to disk.
>> C. Used, but some log records are more recent than last checkpoint
>> and/or not written to disk.
>> D. The active log (where the current log record, "head of the log", is).
>> BACKUP will not actually delete anything from the log file, it will just
>> allow for re-use of the virtual log file. Basically turning C above into
>> B. A and B can be re-used (overwritten whenever the head of the log
>> moves to this virtual log file). These have status 0 in DBCC LOGINFO,
>> while C and D have status 2.
>> Now, above takes some thinking and some visualization in the head (or
>> whiteboard). Which is why I tend to stick with the higher abstraction
>> level for basic questions. :-).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:ucYuxAlYIHA.3964@.TK2MSFTNGP03.phx.gbl...
>> Tibor
>> BACKUP LOG will indeed empty the log file (also known as "truncate"
>> the file).
>> I was thinking that by issuing BACKUP LOG , SQL Server is able to
>> re-use virtual logs file that LOG file is built by and delete only
>> inactive (written to disk) transaction
>>
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com>
>> wrote in message news:uinyn2kYIHA.3400@.TK2MSFTNGP03.phx.gbl...
>> BACKUP LOG will indeed empty the log file (also known as "truncate"
>> the file). If you for some reason don't want to do transaction log
>> backup then set the recovery model for the database to "simple".
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Ant" <Ant@.discussions.microsoft.com> wrote in message
>> news:505DB4BD-BEF0-4708-BEEE-BC4088A82527@.microsoft.com...
>> Hi,
>> I'd like to know what happens to a log file when you back it up. I
>> received
>> an error that my log file had grown too much & that I should back it
>> up,
>> which I did & I no longer received the error.
>> But what happens when you simply back up a log file? Does it also
>> truncate
>> unused space or what? It obviously doesn't simply make a backup of
>> it.
>> Many thanks for helping me understand what is happening here
>> Ant
>>
>>
>>
>>
>

Backing up Database

When I try to backup a SQL 2000 database I recieve the following error in
the output log. Any ideas? Thank you.
SQL 2000 w/ SP4
[39] Database SolRounder: Database Backup...
Destination: [G:\Backups\SolRounder\SolRounder_db_200704131221.BAK]
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3202: [Microsoft][ODBC SQL
Server Driver][SQL Server]Write on
'G:\Backups\SolRounder\SolRounder_db_200704131221.BAK' failed, status = 112.
See the SQL Server error log for more details.
[Microsoft][ODBC SQL Server Driver][SQL Server]BACKUP DATABASE is
terminating abnormally.
[40] Database SolRounderKids: Database Backup...
Destination:
[G:\Backups\SolRounderKids\SolRounderKids_db_200704131223.BAK]Gabe,
Error 112 is probably the Windows ERROR_DISK_FULL, which means that your G:
drive does not have enough space to hold your backup file.
See if you can clean up some things from the drive to give it more space.
RLF
"Gabe Matteson\" <gmatteson.rounder.com.nospam> wrote in message
news:Oz8yowefHHA.4552@.TK2MSFTNGP04.phx.gbl...
> When I try to backup a SQL 2000 database I recieve the following error in
> the output log. Any ideas? Thank you.
> SQL 2000 w/ SP4
> [39] Database SolRounder: Database Backup...
> Destination: [G:\Backups\SolRounder\SolRounder_db_200704131221.BAK]
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3202: [Microsoft][ODBC
> SQL Server Driver][SQL Server]Write on
> 'G:\Backups\SolRounder\SolRounder_db_200704131221.BAK' failed, status => 112. See the SQL Server error log for more details.
> [Microsoft][ODBC SQL Server Driver][SQL Server]BACKUP DATABASE is
> terminating abnormally.
> [40] Database SolRounderKids: Database Backup...
> Destination:
> [G:\Backups\SolRounderKids\SolRounderKids_db_200704131223.BAK]
>|||Working now. Thank you Russell!
"Russell Fields" <russellfields@.nomail.com> wrote in message
news:ueOlD4efHHA.4552@.TK2MSFTNGP04.phx.gbl...
> Gabe,
> Error 112 is probably the Windows ERROR_DISK_FULL, which means that your
> G: drive does not have enough space to hold your backup file.
> See if you can clean up some things from the drive to give it more space.
> RLF
> "Gabe Matteson\" <gmatteson.rounder.com.nospam> wrote in message
> news:Oz8yowefHHA.4552@.TK2MSFTNGP04.phx.gbl...
>> When I try to backup a SQL 2000 database I recieve the following error in
>> the output log. Any ideas? Thank you.
>> SQL 2000 w/ SP4
>> [39] Database SolRounder: Database Backup...
>> Destination: [G:\Backups\SolRounder\SolRounder_db_200704131221.BAK]
>> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3202: [Microsoft][ODBC
>> SQL Server Driver][SQL Server]Write on
>> 'G:\Backups\SolRounder\SolRounder_db_200704131221.BAK' failed, status =>> 112. See the SQL Server error log for more details.
>> [Microsoft][ODBC SQL Server Driver][SQL Server]BACKUP DATABASE is
>> terminating abnormally.
>> [40] Database SolRounderKids: Database Backup...
>> Destination:
>> [G:\Backups\SolRounderKids\SolRounderKids_db_200704131223.BAK]
>

Thursday, March 22, 2012

Backing up a database in one server and restoring in another

Hi,
I am backing up one database in one server and trying to restore it in another server. In the process of retoring, I am getting an error which states that I should be using in single mode.
Question 1) Is this restore process feasible?
Question 2) Is it possible to set single user mode from Sql Server Enterprise Manager. If not, how is this restore can be done.
I am familiar with attach detach method. However, I am trying to see whether this operation works. I appreciate any help in advance. Thanks.
Hi,
Restore database can not be done if yuo have any user connected to the
database. So easy way to restore the databaseis using
the Query Analyzer.
1. Login to Query Analyzer
2. Set the database to single user using the below command
Alter database <dbname> set single_user with rollback immediate
3. Now restore the database
Restore database <dbname> from disk='c:\backup\dbname.bak' (Use Move
command if you dont have the same directory
structure as source server, Use REPLACE option
if you need to overwrite MDF and LDF)
-- See books online for RESTORE DATABASE for more details
4. Set the database to multi user using the below command
Alter database <dbname> set multi_user
1) Is this restore process feasible?
Yes, Set it to single user using above command
2) Is it possible to set single user mode from Sql Server Enterprise Manager
Not directly in a single command, I think you have to kill the users.
Better way is use the above commands specified in Query Analyzer.
Thanks
Hari
MCDBA
"John" <John@.discussions.microsoft.com> wrote in message
news:2F1A00C1-7203-4F42-B86A-25DDEA97EA68@.microsoft.com...
> Hi,
> I am backing up one database in one server and trying to restore it in
another server. In the process of retoring, I am getting an error which
states that I should be using in single mode.
> Question 1) Is this restore process feasible?
> Question 2) Is it possible to set single user mode from Sql Server
Enterprise Manager. If not, how is this restore can be done.
> I am familiar with attach detach method. However, I am trying to see
whether this operation works. I appreciate any help in advance. Thanks.

Backing up a database in one server and restoring in another

Hi,
I am backing up one database in one server and trying to restore it in another server. In the process of retoring, I am getting an error which states that I should be using in single mode.
Question 1) Is this restore process feasible?
Question 2) Is it possible to set single user mode from Sql Server Enterprise Manager. If not, how is this restore can be done.
I am familiar with attach detach method. However, I am trying to see whether this operation works. I appreciate any help in advance. Thanks.Hi,
Restore database can not be done if yuo have any user connected to the
database. So easy way to restore the databaseis using
the Query Analyzer.
1. Login to Query Analyzer
2. Set the database to single user using the below command
Alter database <dbname> set single_user with rollback immediate
3. Now restore the database
Restore database <dbname> from disk='c:\backup\dbname.bak' (Use Move
command if you dont have the same directory
structure as source server, Use REPLACE option
if you need to overwrite MDF and LDF)
-- See books online for RESTORE DATABASE for more details
4. Set the database to multi user using the below command
Alter database <dbname> set multi_user
1) Is this restore process feasible?
Yes, Set it to single user using above command
2) Is it possible to set single user mode from Sql Server Enterprise Manager
Not directly in a single command, I think you have to kill the users.
Better way is use the above commands specified in Query Analyzer.
Thanks
Hari
MCDBA
"John" <John@.discussions.microsoft.com> wrote in message
news:2F1A00C1-7203-4F42-B86A-25DDEA97EA68@.microsoft.com...
> Hi,
> I am backing up one database in one server and trying to restore it in
another server. In the process of retoring, I am getting an error which
states that I should be using in single mode.
> Question 1) Is this restore process feasible?
> Question 2) Is it possible to set single user mode from Sql Server
Enterprise Manager. If not, how is this restore can be done.
> I am familiar with attach detach method. However, I am trying to see
whether this operation works. I appreciate any help in advance. Thanks.sql

Backing up a database in one server and restoring in another

Hi,
I am backing up one database in one server and trying to restore it in anoth
er server. In the process of retoring, I am getting an error which states th
at I should be using in single mode.
Question 1) Is this restore process feasible?
Question 2) Is it possible to set single user mode from Sql Server Enterpris
e Manager. If not, how is this restore can be done.
I am familiar with attach detach method. However, I am trying to see whether
this operation works. I appreciate any help in advance. Thanks.Hi,
Restore database can not be done if yuo have any user connected to the
database. So easy way to restore the databaseis using
the Query Analyzer.
1. Login to Query Analyzer
2. Set the database to single user using the below command
Alter database <dbname> set single_user with rollback immediate
3. Now restore the database
Restore database <dbname> from disk='c:\backup\dbname.bak' (Use Move
command if you dont have the same directory
structure as source server, Use REPLACE option
if you need to overwrite MDF and LDF)
-- See books online for RESTORE DATABASE for more details
4. Set the database to multi user using the below command
Alter database <dbname> set multi_user
1) Is this restore process feasible?
Yes, Set it to single user using above command
2) Is it possible to set single user mode from Sql Server Enterprise Manager
Not directly in a single command, I think you have to kill the users.
Better way is use the above commands specified in Query Analyzer.
Thanks
Hari
MCDBA
"John" <John@.discussions.microsoft.com> wrote in message
news:2F1A00C1-7203-4F42-B86A-25DDEA97EA68@.microsoft.com...
> Hi,
> I am backing up one database in one server and trying to restore it in
another server. In the process of retoring, I am getting an error which
states that I should be using in single mode.
> Question 1) Is this restore process feasible?
> Question 2) Is it possible to set single user mode from Sql Server
Enterprise Manager. If not, how is this restore can be done.
> I am familiar with attach detach method. However, I am trying to see
whether this operation works. I appreciate any help in advance. Thanks.

Monday, March 19, 2012

Back up of Encryption Keys and changing Windows Service Identity

I need to change windows server identity for the report service but I get
following error for this operation
ReportServicesConfigUI.WMIProvider.WMIProviderException: Key not valid for
use in specified state. (Exception from HRESULT: 0x8009000B)
at
ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.ThrowOnError(ManagementBaseObject
mo)
at
ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.BackupEncryptionKey(Byte[]&
encryptedBytes, String password)
What is a solution for this?
Thanks,
ShimonOn Dec 10, 8:11 pm, "Shimon Sim" <shimonsim...@.community.nospam>
wrote:
> I need to change windows server identity for the report service but I get
> following error for this operation
> ReportServicesConfigUI.WMIProvider.WMIProviderException: Key not valid for
> use in specified state. (Exception from HRESULT: 0x8009000B)
> at
> ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.ThrowOnError(ManagementBaseObject
> mo)
> at
> ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.BackupEncryptionKey(Byte[]&
> encryptedBytes, String password)
> What is a solution for this?
> Thanks,
> Shimon
This link might be helpful.
http://www.developmentnow.com/g/115_2007_5_0_0_973220/Report-Server-Windows-Service-MSSQLSERVER.htm
Regards,
Enrique Martinez
Sr. Software Consultant

back up failure error

the problem is
source:kernel
backup medium ::reportloerror:write failure on backup device\\.\tape0.operating system error 23(data error(cyclic reduncancy check));Delete your backup device and start from scratch.

Sunday, March 11, 2012

B

When I'm viewing a measure spliced by all the members of a particular dimension, I get an error in regards to the member name's characters.

Here's how the error appears in the different clients -

SQL BI Studio:

TITLE: Microsoft Visual Studio

A list of actions for the selected items cannot be obtained because of the following error.
XML parsing failed at line 12, column 62: Illegal xml character.
.
This error may have occurred because the definition for at least one action is not valid. Verify the definition for each action using the Actions view.

ADDITIONAL INFORMATION:

XML parsing failed at line 12, column 62: Illegal xml character.
. (Microsoft SQL Server 2005 Analysis Services)

Reporting Service's VS query builder complains:
Error:
' ', hexadecimal value 0x08, is an invalid character. Line 1, position 94333. (System.Xml)

In SQL Management Studio:
When expanding the dimension's children, a message yields "Error occured

retrieving child nodes, The server sent an unrecognizable response"

3 free bugs for any SDETs out there :-)
Are there any known work arounds? What's the best way to filter out these characters (and which characters to we need to filter?)

Probably your dimension table contains invalid XML character as part of member name or key. You can go to the attribute which causes this problem and change the bindings on the NameColumn or KeyColumn (depending which one caused the problem) for InvalidXmlCharacters from the default Preserve to Remove or Replace. This will slow down processing of the attribute a little bit, but it should solve the problem.

HTH,

Mosha (http://www.mosha.com/msolap)

AXSCPHST.DLL error in SQL Agent Error Log

I'm getting the following errors in my SQL Server Agent Error Logs:
[000] Unable to locate entry point for AXSCPHST.DLL in The specified module
could not be found (reason: ?)
[125] Subsystem 'ActiveScripting' could not be loaded (reason:
Initialization failed [subsystem code 0])
I'm running SQL Server 2000 SP4 on Windows Server 2003.
Any clue as to why these errors are appearing and how to eliminate them?
All my DTS tasks with scripts seem to be working inspite of the errors.
Scott
I am having the same problem, do you have a solution?
|||Check the path for the String Value in this registry key.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsof t SQL
Server\80\Tools\ClientSetup]
"SQLPath"="C:\\Program Files\\Microsoft SQL Server\\80\\Tools"
Occasionally it will be missing the "s" at the end. Microsoft says that it
happens during the upgrade from MSDE to full SQL.

AXSCPHST.DLL error in SQL Agent Error Log

I'm getting the following errors in my SQL Server Agent Error Logs:
[000] Unable to locate entry point for AXSCPHST.DLL in The specified mod
ule
could not be found (reason: ')
[125] Subsystem 'ActiveScripting' could not be loaded (reason:
Initialization failed [subsystem code 0])
I'm running SQL Server 2000 SP4 on Windows Server 2003.
Any clue as to why these errors are appearing and how to eliminate them?
All my DTS tasks with scripts seem to be working inspite of the errors.
ScottI am having the same problem, do you have a solution?|||Check the path for the String Value in this registry key.
& #91;HKEY_LOCAL_MACHINE\SOFTWARE\Microsof
t\Microsoft SQL
Server\80\Tools\ClientSetup]
"SQLPath"="C:\\Program Files\\Microsoft SQL Server\\80\\Tools"
Occasionally it will be missing the "s" at the end. Microsoft says that it
happens during the upgrade from MSDE to full SQL.

Axis Object - Auto Interval Error

Hello,
I am trying to plot a graph using the following data expression:
=(sum(Fields!Closed.Value)*7.5)/sum(Fields!FTE.Value)
and I get an error whenever I try to publish the graph:
An error has occured while rendering chart chart1. Details: Axis Object - Auto Interval Error Axis Object - Auto Interval Error
Anyone know what causes this and how it can be fixed?
Thanks
Wow... found the answer. So an error in my data caused this expression to be infinity. The Auto Interval Error can not handle a data point that is infinite so to fix this simply perform a check. In this case:
=iif(sum(Fields!FTE.Value)=0,"100",((sum(Fields!Closed.Value)*7.5)/sum(Fields!FTE.Value)))
I used the value 100 here becasue it is beyond my scall so a value of 100 will be very obvious.

Wednesday, March 7, 2012

awe enabled but still has dynamic memory set

The main reason for these questions is each time I view the propery page for this instance I get and error generated in the event log => 1 Configuration option \'show advanced options\' changed from 1 to 1 <= and even though it is a warning it wasn't there before the awe memory was changed.

The dedicated s2k machine has 8GB of memory. AWE has been enabled, and max server memory set to 5120 (this is a clustered instance and the second machine only has 6 Gb. More is on order). When viewing properties for the instance it shows memory as being dynamic with max server memory = 5120.

Should the memory be set to something other than dynamically managed?

I confirmed the settings via sp_configure and AWE is enabled and memory is 5120... And perf mon shows target memory as around 5120 so it looks like things are set correctly. But the dynamically configure sql memory is still selected.

So is that an issue?

Thanks for any input.

MikeMike,

Set the memory to fixed when you use AWE. This way SQL won't have extend the memory whenever it needs it. It will save you some overhead.|||I was plan on making the change but was looking for some doco from Bill 1st.

Thanks for the response!!

Mike

Saturday, February 25, 2012

Avoiding truncate error

There is some option in Sql Server 2000 to set of avoid errors when a text
larger than destination field is stored in it ?
For example i must do an INSERT INTO NAMES
and NAMES have a field of size 10
if i store a field of size 20 in it the server give me an error
can i avoid this error and store only the firsts 10 bytes in the destination
field?
thanks a lot.Look in BOL for SET ANSI_WARNINGS with the example
"Romano Benedetto" <RomanBe@.tin.it> schrieb im Newsbeitrag
news:UYtee.1336790$35.49871941@.news4.tin.it...
> There is some option in Sql Server 2000 to set of avoid errors when a text
> larger than destination field is stored in it ?
> For example i must do an INSERT INTO NAMES
> and NAMES have a field of size 10
> if i store a field of size 20 in it the server give me an error
> can i avoid this error and store only the firsts 10 bytes in the
> destination field?
> thanks a lot.
>|||Look in BOL for SET ANSI_WARNINGS with the example
PRINT 'Testing String Overflow in INSERT'
GO
INSERT INTO T1 VALUES (4, 4, 'Text string longer than 20 characters')
GO
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Romano Benedetto" <RomanBe@.tin.it> schrieb im Newsbeitrag
news:UYtee.1336790$35.49871941@.news4.tin.it...
> There is some option in Sql Server 2000 to set of avoid errors when a text
> larger than destination field is stored in it ?
> For example i must do an INSERT INTO NAMES
> and NAMES have a field of size 10
> if i store a field of size 20 in it the server give me an error
> can i avoid this error and store only the firsts 10 bytes in the
> destination field?
> thanks a lot.
>

Avoiding the usage of DTC

Hello

I am running an script and the following sentence throws and error because the DTC service is not running in the Remote Server:

insert into MyLocalTable
execute synonym_MyRemoteProcedure @.SomeParameter

Since a transaction is not declared within the script, why is the DTC required?
How can I avoid the usage of the DTC? Is there a way to say "this code is not within a distributed transaction"?

Thanks a lot.You are still in an explicit transaction. As far as I know, the requirement that the DTC service be running can not be bypassed. You can try using just a select statement to get the data from the remote server, as the "black box" nature of the stored procedure may be causing this.

Avoiding EOF Error

I am querying a sql server db from asp/ado. I am trying to get data from a list of people but all of them may not have the data I am looking for. As a result, when the query gets to that person/record, I get the message:

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

How can I avoid this message? Here is my code:

sql="SELECT TrngDate, Effort, UnitMeas FROM TrainingData WHERE PartID = " & CLng(iPartID)

Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 1, 2

Do While Not rs.eof
.
.
.
rs.MoveNext
Loop

I also used the conn.Execute approach.

This a recurring issue for me. Any ideas?Check this KBA (http://support.microsoft.com/default.aspx?scid=kb;en-us;230101) and get the fix if required.

Also check whether that would be a closed recordset while error was returned. And also check whether second RS is opened/returned.|||Originally posted by Satya
Check this KBA (http://support.microsoft.com/default.aspx?scid=kb;en-us;230101) and get the fix if required.

Also check whether that would be a closed recordset while error was returned. And also check whether second RS is opened/returned.

But it doesn't appear that the problem referred to is my issue. My issue is that the record that I am looking for may in fact not exist. I am not sure how to determine that before 'looking' for it. Is there any way I can get a record count? In the past I have tried this and it returns a recordcount of -1.|||In that case while opening of RS just count from the table and use the variable to avoid it.|||Originally posted by Satya
In that case while opening of RS just count from the table and use the variable to avoid it.

but I don't understand how that would look syntactically. Could you show me the code?

Thanks!|||Dont' be sorry..

Rather I fee so, (Im no developer :( )
Still check this webpage (http://www.vbcode.com/asp/showsn.asp?theID=4816) for code example.

Friday, February 24, 2012

Avoiding Divide by Zero in Report

What is the experession to evaluate if the result of a computation would be a divide by zero error for a text box in report?

IIF(divide by zero, display nothing, else display computed result)...?

you should actually use it in your query,but...

=iif(value1 = 0 or value2=0,0, value1/value2)

where the values are the values your dividing by.

it's much easier to do it in sql though...

|||I'd recommend either doing it in your Stored Procedure or creating a function to handle it. You don't want to be putting that expression in every sell in which you're doing division.

You can create a function like the one below and place it in the Report code block or put it in an assembly and reference the assembly in the report.

Public Function CalcAvg(dblNum As Double, dblDen As Double) as Object

if (dblDen = nothing) or (dblDen = 0)
CalcAvg = 0
else
CalcAvg = dblNum / dblDen
end if

End Function|||

I have this code in my Code section

Code Snippet

Public Shared Function DivideXbyY(ByVal X As Decimal, ByVal Y As Decimal) As Decimal
DivideXbyY = IIF(Y=0, 0, X / IIF(Y=0, 1, Y))
End Function

then I call it in the Table/Matrix

Code Snippet

=Code.DivideXbyY(Fields!amt.Value,Fields!tix.Value)

|||Thanks guys, your responses are very helpful and much appreciated.

avoid Timeout expired?

Hi,
When I execute the "Delete" statement in Query for large database, it
prompts the error
"[Microsoft][ODBC SQL Server Driver]Timeout expired"
I know there is setting to configurate it, but I couldn't find out
which one. can anyone tell me please? thanks
--
GinolaThis is a client side configuration issue (ODBC really...)
from query analyzer... you can control this from tools - options -
connections - query time out
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Ginola" <ginola@.mailcity.om> wrote in message
news:403c13f7.8256406@.msnews.microsoft.com...
> Hi,
> When I execute the "Delete" statement in Query for large database, it
> prompts the error
> "[Microsoft][ODBC SQL Server Driver]Timeout expired"
> I know there is setting to configurate it, but I couldn't find out
> which one. can anyone tell me please? thanks
>
> --
> Ginola|||Thanks, I found it. my setting is 0 under QueryTime out, it should
mean unlimited, right ' But I do get the error message
"[Microsoft][ODBC SQL Server Driver]Timeout expired "
when deleting a lot of record under EM !! Any idea?
>This is a client side configuration issue (ODBC really...)
>from query analyzer... you can control this from tools - options -
>connections - query time out
--
Ginola|||Hi,
"0 is Unlimited".
Try to delete the records from Query Analyzer using Delete statement. Here
delete statement will be faster if you have indexes on columns used in where
clause of delete statement.
Thanks
Hari
MCDBA
"Ginola" <ginola@.mailcity.om> wrote in message
news:403d30ed.15670093@.msnews.microsoft.com...
> Thanks, I found it. my setting is 0 under QueryTime out, it should
> mean unlimited, right ' But I do get the error message
> "[Microsoft][ODBC SQL Server Driver]Timeout expired "
> when deleting a lot of record under EM !! Any idea?
>
> >This is a client side configuration issue (ODBC really...)
> >
> >from query analyzer... you can control this from tools - options -
> >connections - query time out
> --
> Ginola|||Hi,
I am really really new in SQL server and I haven't had much experience
in using Query Analyzer. Most of my experience is from MS-Access
If I write the following, will it work ?
Use DBName
go
Delete * from [TableName]
go
Why we don't use delete under EM instead ?
On Wed, 25 Feb 2004 13:04:58 +0530, "Hari" <hari_prasad_k@.hotmail.com>
wrote:
>Hi,
>"0 is Unlimited".
>Try to delete the records from Query Analyzer using Delete statement. Here
>delete statement will be faster if you have indexes on columns used in where
>clause of delete statement.
>Thanks
>Hari
>MCDBA
>
>"Ginola" <ginola@.mailcity.om> wrote in message
>news:403d30ed.15670093@.msnews.microsoft.com...
>> Thanks, I found it. my setting is 0 under QueryTime out, it should
>> mean unlimited, right ' But I do get the error message
>> "[Microsoft][ODBC SQL Server Driver]Timeout expired "
>> when deleting a lot of record under EM !! Any idea?
>>
>> >This is a client side configuration issue (ODBC really...)
>> >
>> >from query analyzer... you can control this from tools - options -
>> >connections - query time out
>> --
>> Ginola
>
Ginola|||Enterprise Manager does not look at the timeout settings used by QA. There
is no way to change the default timeout setting for EM...
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Ginola" <ginola@.mailcity.om> wrote in message
news:403d30ed.15670093@.msnews.microsoft.com...
> Thanks, I found it. my setting is 0 under QueryTime out, it should
> mean unlimited, right ' But I do get the error message
> "[Microsoft][ODBC SQL Server Driver]Timeout expired "
> when deleting a lot of record under EM !! Any idea?
>
> >This is a client side configuration issue (ODBC really...)
> >
> >from query analyzer... you can control this from tools - options -
> >connections - query time out
> --
> Ginola

avoid Timeout expired?

Hi,
When I execute the "Delete" statement in Query for large database, it
prompts the error
"[Microsoft][ODBC SQL Server Driver]Timeout expired"
I know there is setting to configurate it, but I couldn't find out
which one. can anyone tell me please? thanks
GinolaThis is a client side configuration issue (ODBC really...)
from query analyzer... you can control this from tools - options -
connections - query time out
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Ginola" <ginola@.mailcity.om> wrote in message
news:403c13f7.8256406@.msnews.microsoft.com...
> Hi,
> When I execute the "Delete" statement in Query for large database, it
> prompts the error
> "[Microsoft][ODBC SQL Server Driver]Timeout expired"
> I know there is setting to configurate it, but I couldn't find out
> which one. can anyone tell me please? thanks
>
> --
> Ginola|||Thanks, I found it. my setting is 0 under QueryTime out, it should
mean unlimited, right ' But I do get the error message
"[Microsoft][ODBC SQL Server Driver]Timeout expired "
when deleting a lot of record under EM !! Any idea?

>This is a client side configuration issue (ODBC really...)
>from query analyzer... you can control this from tools - options -
>connections - query time out
Ginola|||Hi,
"0 is Unlimited".
Try to delete the records from Query Analyzer using Delete statement. Here
delete statement will be faster if you have indexes on columns used in where
clause of delete statement.
Thanks
Hari
MCDBA
"Ginola" <ginola@.mailcity.om> wrote in message
news:403d30ed.15670093@.msnews.microsoft.com...
> Thanks, I found it. my setting is 0 under QueryTime out, it should
> mean unlimited, right ' But I do get the error message
> "[Microsoft][ODBC SQL Server Driver]Timeout expired "
> when deleting a lot of record under EM !! Any idea?
>
> --
> Ginola|||Hi,
I am really really new in SQL server and I haven't had much experience
in using Query Analyzer. Most of my experience is from MS-Access
If I write the following, will it work ?
Use DBName
go
Delete * from [TableName]
go
Why we don't use delete under EM instead ?
On Wed, 25 Feb 2004 13:04:58 +0530, "Hari" <hari_prasad_k@.hotmail.com>
wrote:

>Hi,
>"0 is Unlimited".
>Try to delete the records from Query Analyzer using Delete statement. Here
>delete statement will be faster if you have indexes on columns used in wher
e
>clause of delete statement.
>Thanks
>Hari
>MCDBA
>
>"Ginola" <ginola@.mailcity.om> wrote in message
>news:403d30ed.15670093@.msnews.microsoft.com...
>
Ginola|||Enterprise Manager does not look at the timeout settings used by QA. There
is no way to change the default timeout setting for EM...
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Ginola" <ginola@.mailcity.om> wrote in message
news:403d30ed.15670093@.msnews.microsoft.com...
> Thanks, I found it. my setting is 0 under QueryTime out, it should
> mean unlimited, right ' But I do get the error message
> "[Microsoft][ODBC SQL Server Driver]Timeout expired "
> when deleting a lot of record under EM !! Any idea?
>
> --
> Ginola|||Try a Truncate table <tablename>. It's the fastest way to delete all records
from a table.

Avoid duplicate primary key error

How can I avoid duplicate primary key error when I use DetailsView Inserting that the field column is one of the primary key ?

Thanks in advance !

stephen

Before insertin the new row, you can check the table to see whether there is a row in the table with the same key value as the new row. For example:

if exists (select * from Orders where OrderID=@.newOrderID)

//not insert

else //insert

|||

Can you show me the detail of correct syntax ? I'm very new in ASP.NET 2.0. I did type the statement in the ??.aspx.cs and syntax error found.

stephen

|||

Sorry I forgot to say: the code in my last post is T-SQL statements, so you can use them in SqlCommand or something else.