Showing posts with label guys. Show all posts
Showing posts with label guys. Show all posts

Friday, March 30, 2012

restrict query results

Hi guys, say i wrote a query that returns 1,000 records.. what kinda query could i write that only returns say the first 50 records of the 1,000 recs..

SELECT TOP 50 * FROM yourTable

|||thanks alot, another question.. what if i wanted the result 100 to 150?|||the way I phrased that question was kinda ambigous.. i'll put it in a clearer way. say if out of that 1,000 results i wanted record 100 to record 150 basically skipping the first 99 records and returning those 50 results in the middle, how could i code that in sql?|||With SQLPaging As
(
Select Row_number() Over (Order by MyField) as RunningNumber,*
From MyTable
)
Select * from SQLPaging
Where RunningNumber between 100 and 150

Monday, March 26, 2012

restoring the database

Hi,

Two of my hard drives went down yesterday. and with it went the Sql server database.The data recovery guys recovered the back up database (.bak) file.I have since reinstalled SQL Server 2000 and now when i try and restore the .bak file it says the Microsoft tape back up file set is not valid when i try and open the .bak file.

Whats the right way to add my databse to the SQl Server2000 using my .bak file and if anyone has come across the error they could help.

Thanks

LDid you apply all SPs that your old server used to have?|||what do u mean by sps|||what do u mean by sps

Stored Procedure|||It's "Service Packs", not stored procedures...how do you apply a stored procedure anyway?|||Restore the databases...which she can't do. DOH!!! :)

You should always verify your backups, especially if writing directly to tape. Any luck though after applying the service packs? Don't you guys have a DBA who can help with this?|||It's "Service Packs", not stored procedures...how do you apply a stored procedure anyway?

Yes. It should be Service Packs|||Hi Lohit,

hows was your process of restoring the backup?

Saturday, February 25, 2012

Restoring DB problem HELP!

Hello guys.

Here is my problem i had a DB on my SQL Server 2005 Named PROTE the DB got deleted by some developer i do not have the .BK file anymore and my MDF and LDF as moved to a new location eg: PROTE MDF & LDF where on the drive D: and now PROTE.MDF is in a folder like D:\DATA MDF and PROTE.LDF is in a folder like D:\DATA LDF.

How do i restore please help.you might be able to do a sp_attach_db.|||thanks that worked|||you might be able to do a sp_attach_db.

You are my hero|||why? because I can answer a simple admin question? Or are you already into your 5 o'clock happy hour?|||Or are you already into your 5 o'clock happy hour?

===========> eye

Lunch was good

Restoring databases

Guys,
I need to restore a database which is 400 GB plus. Usually a normal
restore from a backup file takes about 40 minutes. I have a database
Company on a server A. I need to use the backup of database company to
restore as company1 on the same box. At the end, company and company1
would reside on the same box. Is there any way to do it faster than a
normal restore?

Thanks in advance.

Regards

Jaideepjai (dbasybase@.gmail.com) writes:

Quote:

Originally Posted by

I need to restore a database which is 400 GB plus. Usually a normal
restore from a backup file takes about 40 minutes. I have a database
Company on a server A. I need to use the backup of database company to
restore as company1 on the same box. At the end, company and company1
would reside on the same box. Is there any way to do it faster than a
normal restore?


Are you on SQL 2000? I'm afraid not. Rather it will take longer time,
since the 400 GB for the new database needs to be initialised.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||I am on sql2005. The database in question, is on single mdf and single
ldf with full text catalogs. Can't I do a sp_attach_single_file_db with
mdf file. I tried it on a smaller database and it created a log file.

Regards

Jaideep
Erland Sommarskog wrote:

Quote:

Originally Posted by

jai (dbasybase@.gmail.com) writes:

Quote:

Originally Posted by

I need to restore a database which is 400 GB plus. Usually a normal
restore from a backup file takes about 40 minutes. I have a database
Company on a server A. I need to use the backup of database company to
restore as company1 on the same box. At the end, company and company1
would reside on the same box. Is there any way to do it faster than a
normal restore?


>
Are you on SQL 2000? I'm afraid not. Rather it will take longer time,
since the 400 GB for the new database needs to be initialised.
>
>
>
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
>
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

|||jai (dbasybase@.gmail.com) writes:

Quote:

Originally Posted by

I am on sql2005. The database in question, is on single mdf and single
ldf with full text catalogs. Can't I do a sp_attach_single_file_db with
mdf file. I tried it on a smaller database and it created a log file.


Yes, you should be able to detach the original database, copy the files
and attach the copies. But since you asked about restore, I assumed that
you had a backup already. Also, while copy and attach is likely to be
faster, it means that the original database is offline while you copy.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Tuesday, February 21, 2012

Restoring database in SQL server 2005 Beta 2

Hi guys,
I have a problem with restoring database in SQL server 2005 Beta 2:

Restore failed for Server '[ZEDNIK\TELBILL]'. (Microsoft.SqlServer.Smo)
-
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft SQL Server&ProdVer=9.00.852.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
-
=============================================

System.Data.SqlClient.SqlError: The backed-up database has on-disk structure version 611. The server supports version 587 and cannot restore or upgrade this database. (Microsoft.SqlServer.Smo)

I have searched for some patches or something, but I haven't found anything.
Please if some of you know how to solve this problem, HELP!!!

Thanks,

Tomas

where did you obtain this database backup from? Was it from a later version of SQL Server 2005? If so, I don't think you can restore a database backup to an earlier beta version of SQL 2005.

What you need to do is upgrade you version of SQL Server to the version that created the db backup, then your restore should work.

Restoring database in SQL server 2005 Beta 2

Hi guys,
I have a problem with restoring database in SQL server 2005 Beta 2:

Restore failed for Server '[ZEDNIK\TELBILL]'. (Microsoft.SqlServer.Smo)
-
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft SQL Server&ProdVer=9.00.852.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
-
=============================================

System.Data.SqlClient.SqlError: The backed-up database has on-disk structure version 611. The server supports version 587 and cannot restore or upgrade this database. (Microsoft.SqlServer.Smo)

I have searched for some patches or something, but I haven't found anything.
Please if some of you know how to solve this problem, HELP!!!

Thanks,

Tomas

where did you obtain this database backup from? Was it from a later version of SQL Server 2005? If so, I don't think you can restore a database backup to an earlier beta version of SQL 2005.

What you need to do is upgrade you version of SQL Server to the version that created the db backup, then your restore should work.