Showing posts with label figure. Show all posts
Showing posts with label figure. Show all posts

Monday, March 19, 2012

Maximum SQL 2005 Database Size

Hello! I'm trying to figure out what the ultimate size limitation for a SQL 2005 Enterprise server is. This document is helpful but I'm a bit confused:

http://msdn2.microsoft.com/en-us/library/ms143432.aspx

In the document, it says that the maximum database size is 524,258 terabytes; however, it also says that the maximum data file size--which I assume is the .MDF file--is 16 terabytes. My question is, how can you create a 524,258 TB database if the maximum file size 16 TB?

Dumb question, I'm sure...please enlighten me!

Norm

A database have minimum a data file and a log file so

(I quote from that document)

File size (data)

16 terabytes

16 terabytes

File size (log)

2 terabytes

2 terabytes

mean that you can have (528,258-2):16=33016 data files (id est 1 mdf file and 33015 ndf files) and 1 log file.

Or other combination of data and log files that totalize 528,258 terabytes.

|||I still don't understand. If I create a database, call it NewJack, the system automatically creates an .MDF file named newjack.mdf. If that file is limited to 16TB, then my NewJack database can only be 16TB...right?|||

In Management Studio right click on your database go to properties then go to files and file groups, these two properties let you add and remove MDF, LDF and NDF as needed. That is you can place a set of tables in a file group and the indexes in separate file groups try the link below for how you can use the file groups to separate fast growing databases into smaller manageable file groups.

http://msdn2.microsoft.com/en-us/library/ms179316.aspx

Monday, February 20, 2012

Max Value in Column Other than Return Value Column

Hi,
This may be a very simple query but I couldn't figure out how to do it. I
have a table with two columns, COL1 and COL2. I need to write a query that
will return the value of COL1 from the row where COL2 has the greatest value
.
For example,
COL1 COL2
-- --
A 2
B 3
C 1
The query should return "B".
I don't know if this makes a difference, but this query will actually be a
subquery in the select clause of a main query.
Thanks!
JohnSELECT COL1
FROM myTable
WHERE COL2=(SELECT MAX(COL2) FROM myTable)
Note that if COL2 is not unique you may get multiple
rows back|||Here is one way to do it:
declare @.tbl table
(
col1 varchar (10)
, col2 int
)
insert into @.tbl
values ('A',1)
insert into @.tbl
values ('B',3)
insert into @.tbl
values ('C',2)
-- Actual Query
select a.Col1
from @.tbl a
inner join (select MAX(col2) col2
from @.tbl
) b
on a.col2 = b.col2
"John Walker" wrote:

> Hi,
> This may be a very simple query but I couldn't figure out how to do it. I
> have a table with two columns, COL1 and COL2. I need to write a query tha
t
> will return the value of COL1 from the row where COL2 has the greatest val
ue.
> For example,
> COL1 COL2
> -- --
> A 2
> B 3
> C 1
> The query should return "B".
> I don't know if this makes a difference, but this query will actually be a
> subquery in the select clause of a main query.
> Thanks!
> John
>|||Ok, i see. You have to use a subquery to first get that Max value then use
that to filter. Yeah that makes sense.
Thanks,
John
"John Walker" wrote:

> Hi,
> This may be a very simple query but I couldn't figure out how to do it. I
> have a table with two columns, COL1 and COL2. I need to write a query tha
t
> will return the value of COL1 from the row where COL2 has the greatest val
ue.
> For example,
> COL1 COL2
> -- --
> A 2
> B 3
> C 1
> The query should return "B".
> I don't know if this makes a difference, but this query will actually be a
> subquery in the select clause of a main query.
> Thanks!
> John
>|||Or you could use TOP:
SELECT TOP 1 col1
FROM T1
ORDER BY col2 DESC;
Note though, that if col2 is not unique, this query is non-deterministic
(more than one possible "correct" result), and will still return a single
row.
Unlike the following query which can potentially return multiple rows:
SELECT col1
FROM T1
WHERE col2 =
(SELECT MAX(col2)
FROM T1);
If col2 is non-unique, and you're still after a deterministic result with a
single row, you need to introduce a tiebreaker. For example, you can use the
primary key:
SELECT TOP 1 col1
FROM T1
ORDER BY col2 DESC, pk DESC;
BG, SQL Server MVP
www.SolidQualityLearning.com
www.insidetsql.com
Anything written in this message represents my view, my own view, and
nothing but my view (WITH SCHEMABINDING), so help me my T-SQL code.
"John Walker" <JohnWalker@.discussions.microsoft.com> wrote in message
news:AFF206D6-74E3-482E-B095-D128F2F90A1A@.microsoft.com...
> Ok, i see. You have to use a subquery to first get that Max value then
> use
> that to filter. Yeah that makes sense.
> Thanks,
> John
> "John Walker" wrote:
>