Showing posts with label ofthe. Show all posts
Showing posts with label ofthe. Show all posts

Wednesday, March 7, 2012

Database Restore

I made a very big mistake. In Enterprise Manager I right clicked on one of
the databases and selected Delete. In addition I answered OK to the
following dialog box. I realize that this was wrong. Now I need to restore
it. Immediately before deleting I right-clicked, selected all tasks and
Backup Database. I can see the file in the \\program files\Microsoft SQL
Sever\MSSQL\BACKUP directory. How do I restore the database using this file.
Try:
restore database MyDB
from disk = 'C:\Program Files\Microsoft SQL Sever\MSSQL\BACKUP\MyDB.bak'
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Robert Brown" <RobertBrown@.discussions.microsoft.com> wrote in message
news:BE05A364-2F57-4FCF-81DE-E4C1A1B2662D@.microsoft.com...
I made a very big mistake. In Enterprise Manager I right clicked on one of
the databases and selected Delete. In addition I answered OK to the
following dialog box. I realize that this was wrong. Now I need to restore
it. Immediately before deleting I right-clicked, selected all tasks and
Backup Database. I can see the file in the \\program files\Microsoft SQL
Sever\MSSQL\BACKUP directory. How do I restore the database using this
file.
|||Hi,
Or from Enterprise manager:-
1. Right click above the databases option
2. All Tasks...Restore database.. Give the database name in "Restore as
database:....
3.CLick the select devices command button
4. Click add and select the backup file
5. Click OK
6. In the main restore screen "Click OK
Thanks
hari
SQL Server mvp
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:eqZHAc0sFHA.1444@.TK2MSFTNGP10.phx.gbl...
> Try:
> restore database MyDB
> from disk = 'C:\Program Files\Microsoft SQL Sever\MSSQL\BACKUP\MyDB.bak'
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Robert Brown" <RobertBrown@.discussions.microsoft.com> wrote in message
> news:BE05A364-2F57-4FCF-81DE-E4C1A1B2662D@.microsoft.com...
> I made a very big mistake. In Enterprise Manager I right clicked on one
> of
> the databases and selected Delete. In addition I answered OK to the
> following dialog box. I realize that this was wrong. Now I need to
> restore
> it. Immediately before deleting I right-clicked, selected all tasks and
> Backup Database. I can see the file in the \\program files\Microsoft SQL
> Sever\MSSQL\BACKUP directory. How do I restore the database using this
> file.
>

Database Restore

I made a very big mistake. In Enterprise Manager I right clicked on one of
the databases and selected Delete. In addition I answered OK to the
following dialog box. I realize that this was wrong. Now I need to restore
it. Immediately before deleting I right-clicked, selected all tasks and
Backup Database. I can see the file in the \\program files\Microsoft SQL
Sever\MSSQL\BACKUP directory. How do I restore the database using this file
.Try:
restore database MyDB
from disk = 'C:\Program Files\Microsoft SQL Sever\MSSQL\BACKUP\MyDB.bak'
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Robert Brown" <RobertBrown@.discussions.microsoft.com> wrote in message
news:BE05A364-2F57-4FCF-81DE-E4C1A1B2662D@.microsoft.com...
I made a very big mistake. In Enterprise Manager I right clicked on one of
the databases and selected Delete. In addition I answered OK to the
following dialog box. I realize that this was wrong. Now I need to restore
it. Immediately before deleting I right-clicked, selected all tasks and
Backup Database. I can see the file in the \\program files\Microsoft SQL
Sever\MSSQL\BACKUP directory. How do I restore the database using this
file.|||Hi,
Or from Enterprise manager:-
1. Right click above the databases option
2. All Tasks...Restore database.. Give the database name in "Restore as
database:....
3.CLick the select devices command button
4. Click add and select the backup file
5. Click OK
6. In the main restore screen "Click OK
Thanks
hari
SQL Server mvp
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:eqZHAc0sFHA.1444@.TK2MSFTNGP10.phx.gbl...
> Try:
> restore database MyDB
> from disk = 'C:\Program Files\Microsoft SQL Sever\MSSQL\BACKUP\MyDB.bak'
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Robert Brown" <RobertBrown@.discussions.microsoft.com> wrote in message
> news:BE05A364-2F57-4FCF-81DE-E4C1A1B2662D@.microsoft.com...
> I made a very big mistake. In Enterprise Manager I right clicked on one
> of
> the databases and selected Delete. In addition I answered OK to the
> following dialog box. I realize that this was wrong. Now I need to
> restore
> it. Immediately before deleting I right-clicked, selected all tasks and
> Backup Database. I can see the file in the \\program files\Microsoft SQL
> Sever\MSSQL\BACKUP directory. How do I restore the database using this
> file.
>

Sunday, February 19, 2012

Database Queries Using DATE

I am doing a database query in Java, and it seems to work fine using any of
the fields except for the date. I am assuming that this has something to do
with my syntax, since the DATE type has the most complicated syntax. My
query looks like the following:
SELECT * FROM Employee WHERE BDATE='4/20/1981'
BDATE is the field name, which is obviously of type DATE, and the error I
recieve is:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Dat
a type
mismatch in criteria expression.
I am assuming that when it says "Data type mismatch" it is interpreting
'4/20/1981' as a string. But because that is the format I used in the INSERT
statements when I added the records to the table. If this is the problem,
what should my query string? Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com> SELECT * FROM Employee WHERE BDATE='4/20/1981'
Ugh. Use a standard format. If you were looking for April 11th, Access or
your client app could easily misinterpret it as November 4th. If you use a
standard and unambiguous format, that won't happen.

> java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] D
ata type
> mismatch in criteria expression.
If you are querying Access, why are you posting to Java and SQL Server
groups? Learn how to use the tool you're using. Access requires dates to
be delimited by #, not ' ... try this, assuming your "date field" has no
time information:
SELECT * FROM Employee WHERE BDATE = '1981-04-20'
And BTW, don't use SELECT * in production code...
Followups set to microsoft.public.access.queries only.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/