Showing posts with label size. Show all posts
Showing posts with label size. Show all posts

Wednesday, March 28, 2012

How to get the SQL database size

Is it possible to get the SQL Server database size programmatically?
I have an WEB application in c# ASP NET, but I can found any information about.

Thanks for your attention

Freedeveloperread this post:
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=601604|||Hello!

Ok, Thank for the help.
I resolve the question in microsoft c# forum wit the use of sp_helpdb

SqlCommand cmd = new SqlCommand("sp_helpdb",objConexion);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@.dbname",databasename);

this store procedure return the database size and another data.

thaks,

Freedevelopersql

How to get the size of a table

Hi
Have anyone know how to get the info. of the size of s table?EXEC sp_spaceused <table name>
--
Jacco Schalkwijk
SQL Server MVP
"cyshang" <anonymous@.discussions.microsoft.com> wrote in message
news:50CC941F-24D0-46DC-905C-93521419A6D8@.microsoft.com...
> Hi,
> Have anyone know how to get the info. of the size of s table?|||hi
sp_spaceused 'table'
Note: It may provide inaccurate output ,therefore try to update statistics.
"cyshang" <anonymous@.discussions.microsoft.com> wrote in message
news:50CC941F-24D0-46DC-905C-93521419A6D8@.microsoft.com...
> Hi,
> Have anyone know how to get the info. of the size of s table?|||To add to Uri's, you can run
"sp_spaceused tablename, true"
command to update the stats and get the size for the table
HTH
--
Ray Higdon MCSE, MCDBA, CCNA
--
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OkgIhrz3DHA.360@.TK2MSFTNGP12.phx.gbl...
> hi
> sp_spaceused 'table'
> Note: It may provide inaccurate output ,therefore try to update
statistics.
>
> "cyshang" <anonymous@.discussions.microsoft.com> wrote in message
> news:50CC941F-24D0-46DC-905C-93521419A6D8@.microsoft.com...
> > Hi,
> > Have anyone know how to get the info. of the size of s table?
>|||A quick way is to open Enterprise Manager, under View,
click taskpad. On the right is a tab called tables. Open
and enter table name for details.
Don Saluga
>--Original Message--
>Hi,
> Have anyone know how to get the info. of the size of s
table?
>.
>

How to get the size of a table

Hi,
Have anyone know how to get the info. of the size of s table?EXEC sp_spaceused <table name>
Jacco Schalkwijk
SQL Server MVP
"cyshang" <anonymous@.discussions.microsoft.com> wrote in message
news:50CC941F-24D0-46DC-905C-93521419A6D8@.microsoft.com...
quote:

> Hi,
> Have anyone know how to get the info. of the size of s table?
|||hi
sp_spaceused 'table'
Note: It may provide inaccurate output ,therefore try to update statistics.
"cyshang" <anonymous@.discussions.microsoft.com> wrote in message
news:50CC941F-24D0-46DC-905C-93521419A6D8@.microsoft.com...
quote:

> Hi,
> Have anyone know how to get the info. of the size of s table?
|||To add to Uri's, you can run
"sp_spaceused tablename, true"
command to update the stats and get the size for the table
HTH
Ray Higdon MCSE, MCDBA, CCNA
--
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OkgIhrz3DHA.360@.TK2MSFTNGP12.phx.gbl...
quote:

> hi
> sp_spaceused 'table'
> Note: It may provide inaccurate output ,therefore try to update

statistics.
quote:

>
> "cyshang" <anonymous@.discussions.microsoft.com> wrote in message
> news:50CC941F-24D0-46DC-905C-93521419A6D8@.microsoft.com...
>
sql

Friday, March 23, 2012

How to get the images files size?

Hi,
I want to retrive the images from SQL database and store into microsoft access database.
But only images file which is <than 500mb is allowed to retireve.How can i get the images files size if i just store the image file name into my sql database.(there is another folder to store images)

p@.ywen.You can use something like this:


// Create a reference to the image directory.
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(strFileDirectory);
// Create an array representing the files in the current directory.
System.IO.FileInfo[] fi = di.GetFiles("*.jpg");

// then get file size
int fileSize = fi[0].Length;

|||Thanks for your reply, but one more question here.

After i create the array to store the images, then when i wan to get the files size
i need to loop until EOF right?|||No, you can just loop through the array using a standard for or a foreach.sql

how to get the db files size ?

how to get the db files size ?Look ath this post:
http://groups.google.de/group/micro...ce71382782a1c6b
HTH, Jens Suessmeyer.

Monday, March 19, 2012

How to get size of an image data type field stored in my SQL Server Database

Hi,
I have a problem and don't know how to solve it.
I am storing files (jpg, etc) in a table as binaries (image data type)
and would like to be able to show progress bar when I am loading it
from database.
But to do that, I need somehow to get the size of that file that is
stored in database (as image data type). Unfortunatelly my table does
not have a 'file_size' column from where I could get the size of image
and I am not in position to change that.
So far I am reading or writing to databasse successfully using
FileStream or BinaryREader/Writer (in VB.NET), so that is not the
problem.
Does anybody know how can I get the size of an file stored in
database?
Any help will be greatelly appreciated
Try the following function
select datalength(imagecolumn) from table where x=y
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:j74v21t1saqrl2b25cr16dnc93mo00emv3@.4ax.com...
> Hi,
> I have a problem and don't know how to solve it.
> I am storing files (jpg, etc) in a table as binaries (image data type)
> and would like to be able to show progress bar when I am loading it
> from database.
> But to do that, I need somehow to get the size of that file that is
> stored in database (as image data type). Unfortunatelly my table does
> not have a 'file_size' column from where I could get the size of image
> and I am not in position to change that.
> So far I am reading or writing to databasse successfully using
> FileStream or BinaryREader/Writer (in VB.NET), so that is not the
> problem.
> Does anybody know how can I get the size of an file stored in
> database?
> Any help will be greatelly appreciated
>

How to get size of an image data type field stored in my SQL Server Database

Hi,
I have a problem and don't know how to solve it.
I am storing files (jpg, etc) in a table as binaries (image data type)
and would like to be able to show progress bar when I am loading it
from database.
But to do that, I need somehow to get the size of that file that is
stored in database (as image data type). Unfortunatelly my table does
not have a 'file_size' column from where I could get the size of image
and I am not in position to change that.
So far I am reading or writing to databasse successfully using
FileStream or BinaryREader/Writer (in VB.NET), so that is not the
problem.
Does anybody know how can I get the size of an file stored in
database?
Any help will be greatelly appreciatedThis is a multi-part message in MIME format.
--030403020708070709060401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
SELECT DATALENGTH(MyImageColumn), MyImageColumn, ... FROM TableOwner.MyTable
WHERE ...
--
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
Dino Buljubasic wrote:
>Hi,
>I have a problem and don't know how to solve it.
>I am storing files (jpg, etc) in a table as binaries (image data type)
>and would like to be able to show progress bar when I am loading it
>from database.
>But to do that, I need somehow to get the size of that file that is
>stored in database (as image data type). Unfortunatelly my table does
>not have a 'file_size' column from where I could get the size of image
>and I am not in position to change that.
>So far I am reading or writing to databasse successfully using
>FileStream or BinaryREader/Writer (in VB.NET), so that is not the
>problem.
>Does anybody know how can I get the size of an file stored in
>database?
>Any help will be greatelly appreciated
>
>
--030403020708070709060401
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>SELECT DATALENGTH(MyImageColumn), MyImageColumn, ... FROM
TableOwner.MyTable<br>
WHERE ...<br>
</tt>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font> </span><b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"> <font face="Tahoma"
size="2">|</font><i><font face="Tahoma"> </font><font face="Tahoma"
size="2"> database administrator</font></i><font face="Tahoma" size="2">
| mallesons</font><font face="Tahoma"> </font><font face="Tahoma"
size="2">stephen</font><font face="Tahoma"> </font><font face="Tahoma"
size="2"> jaques</font><font face="Tahoma"><br>
</font><b><font face="Tahoma" size="2">T</font></b><font face="Tahoma"
size="2"> +61 (2) 9296 3668 |</font><b><font face="Tahoma"> </font><font
face="Tahoma" size="2"> F</font></b><font face="Tahoma" size="2"> +61
(2) 9296 3885 |</font><b><font face="Tahoma"> </font><font
face="Tahoma" size="2">M</font></b><font face="Tahoma" size="2"> +61
(408) 675 907</font><br>
<b><font face="Tahoma" size="2">E</font></b><font face="Tahoma" size="2">
<a href="http://links.10026.com/?link=mailto:mike.hodgson@.mallesons.nospam.com">
mailto:mike.hodgson@.mallesons.nospam.com</a> |</font><b><font
face="Tahoma"> </font><font face="Tahoma" size="2">W</font></b><font
face="Tahoma" size="2"> <a href="http://links.10026.com/?link=/">http://www.mallesons.com">
http://www.mallesons.com</a></font></span> </p>
</div>
<br>
<br>
Dino Buljubasic wrote:
<blockquote cite="midj74v21t1saqrl2b25cr16dnc93mo00emv3@.4ax.com"
type="cite">
<pre wrap="">Hi,
I have a problem and don't know how to solve it.
I am storing files (jpg, etc) in a table as binaries (image data type)
and would like to be able to show progress bar when I am loading it
from database.
But to do that, I need somehow to get the size of that file that is
stored in database (as image data type). Unfortunatelly my table does
not have a 'file_size' column from where I could get the size of image
and I am not in position to change that.
So far I am reading or writing to databasse successfully using
FileStream or BinaryREader/Writer (in VB.NET), so that is not the
problem.
Does anybody know how can I get the size of an file stored in
database?
Any help will be greatelly appreciated
</pre>
</blockquote>
</body>
</html>
--030403020708070709060401--|||Try the following function
select datalength(imagecolumn) from table where x=y
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:j74v21t1saqrl2b25cr16dnc93mo00emv3@.4ax.com...
> Hi,
> I have a problem and don't know how to solve it.
> I am storing files (jpg, etc) in a table as binaries (image data type)
> and would like to be able to show progress bar when I am loading it
> from database.
> But to do that, I need somehow to get the size of that file that is
> stored in database (as image data type). Unfortunatelly my table does
> not have a 'file_size' column from where I could get the size of image
> and I am not in position to change that.
> So far I am reading or writing to databasse successfully using
> FileStream or BinaryREader/Writer (in VB.NET), so that is not the
> problem.
> Does anybody know how can I get the size of an file stored in
> database?
> Any help will be greatelly appreciated
>

How to get size of an image data type field stored in my SQL Server Database

Hi,
I have a problem and don't know how to solve it.
I am storing files (jpg, etc) in a table as binaries (image data type)
and would like to be able to show progress bar when I am loading it
from database.
But to do that, I need somehow to get the size of that file that is
stored in database (as image data type). Unfortunatelly my table does
not have a 'file_size' column from where I could get the size of image
and I am not in position to change that.
So far I am reading or writing to databasse successfully using
FileStream or BinaryREader/Writer (in VB.NET), so that is not the
problem.
Does anybody know how can I get the size of an file stored in
database?
Any help will be greatelly appreciatedTry the following function
select datalength(imagecolumn) from table where x=y
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:j74v21t1saqrl2b25cr16dnc93mo00emv3@.
4ax.com...
> Hi,
> I have a problem and don't know how to solve it.
> I am storing files (jpg, etc) in a table as binaries (image data type)
> and would like to be able to show progress bar when I am loading it
> from database.
> But to do that, I need somehow to get the size of that file that is
> stored in database (as image data type). Unfortunatelly my table does
> not have a 'file_size' column from where I could get the size of image
> and I am not in position to change that.
> So far I am reading or writing to databasse successfully using
> FileStream or BinaryREader/Writer (in VB.NET), so that is not the
> problem.
> Does anybody know how can I get the size of an file stored in
> database?
> Any help will be greatelly appreciated
>

How to get size of a table

Hello,

I want to get size of a particular table. I have used the wizard provided by SQL Server Enterprise Manager. But it is giving wrong size. If the data of some cells has been deleted or some rows are deleted. It shows the same size which it shows for the first time. I have also used sp_spaceused but is showing the same behaviour as mentioned above. I deleted some rows from the table but is showing the same size.I want to know the size exactly, so that i can come to know that some rows has been deleted or data is corrupted. Please tell me the solution as early as possible.

Haider Ali Khan

sp_spaceused()

Monday, March 12, 2012

How to get row size

using sql 2k, what's the fastest and easiest way to get the row size of a
row. I hava a number of rows I need to look at.
Thanks.
moondaddy@.noemail.noemailHello,
If you need to estimate the size of a table, you can use the following
Excel file:
http://www.microsoft.com/downloads/...&displaylang=en
The size of each row can be variable (if there are variable-length
columns in the table). If you want to see the min/max/avg row size in
an existing table, you can use:
DBCC SHOWCONTIG ('table name') WITH TABLERESULTS
AFAIK, there is no direct method to get the row size for a particular
row in an existing table. If you need this information, copy that row
in an empty table with the same structure and use DBCC SHOWCONTIG, as
shown above.
Razvan|||this will give you the min size and max size of the rows in you table, then
make an educated guess..
This is the easiest way
select minlen,xmaxlen from sysindexes where indid in (1,0) and id =
object_id('tbl_name')|||Thanks for the reply.
What I'm trying to determin is how close a table is to the max rowsize of
8060. I dont see what part of this is going to help me with that.
I used DBCC SHOWCONTIG ('table name') WITH TABLERESULTS
and got the result below. Should I be able to guestimate the total rowsize
from this?
tbLeaseDt
898102240
PK_tbLeaseDt
1
0
45
1325
120
1431
263.83100000000002
0
7
6
268.73300170898437
96.679847717285156
85.714285714285708
6
7
0.0
14.285714149475098
moondaddy@.noemail.noemail
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1146811248.235424.294000@.e56g2000cwe.googlegroups.com...
> Hello,
> If you need to estimate the size of a table, you can use the following
> Excel file:
> http://www.microsoft.com/downloads/...&displaylang=en
> The size of each row can be variable (if there are variable-length
> columns in the table). If you want to see the min/max/avg row size in
> an existing table, you can use:
> DBCC SHOWCONTIG ('table name') WITH TABLERESULTS
> AFAIK, there is no direct method to get the row size for a particular
> row in an existing table. If you need this information, copy that row
> in an empty table with the same structure and use DBCC SHOWCONTIG, as
> shown above.
> Razvan
>|||Thanks. can you please explain how I would guess the approximate total row
size using the min size and max size in the table? I may have a number
varchar columns of large size along with many other columns. even though
none of the current data in the columns is more then a length of 50.
Therefore, wouldn't the max rowsize be superficially low?
moondaddy@.noemail.noemail
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:017A12EC-48E1-409B-9A03-190E9630B9C2@.microsoft.com...
> this will give you the min size and max size of the rows in you table,
> then
> make an educated guess..
> This is the easiest way
> select minlen,xmaxlen from sysindexes where indid in (1,0) and id =
> object_id('tbl_name')
>|||>From these results, you can see that the row size for the smallest row
is 120, the row size for the biggest row is 1431 and the average row
size is 263.83100000000002. These informations are referring to the
rows that exist in the table at this time.
If you want the row size of largest row that can be inserted in the
table, you can compute this size based on the definitions of your
columns (that can be found in the syscolumns table), using the
informations presented in the Books Online topic "estimating table
size":
http://msdn.microsoft.com/library/e...des_02_92k3.asp
Razvan|||Hello,
You could use DATALENGTH() for a quick measure of row size.
Please see "Estimating the Size of a Table" in BOL for some related
infrmation.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

Sunday, February 19, 2012

How to get file path of datafiles etc

I know I can use sp_helpdb <db name> to get information about a database.
This SP gives me 2 result sets - one with name, owner, size etc and one with
a list of the files that make up the db.
What I want to do is get the filename column of the second result set into a
variable in my script. Is there a way I can do this ? Maybe use a cursor
in a way I don't know that allows me to specify that it should use the
second result set ?
TIA
Steve
See sp_helpfile in SQL Server Books Online. You could save the results of
this proc to a temporary table, using the INSERT...EXEC syntax.
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Steve W" <lsl@.btconnect.com> wrote in message
news:uFi%23DyvaEHA.3664@.TK2MSFTNGP12.phx.gbl...
> I know I can use sp_helpdb <db name> to get information about a database.
> This SP gives me 2 result sets - one with name, owner, size etc and one
with
> a list of the files that make up the db.
> What I want to do is get the filename column of the second result set into
a
> variable in my script. Is there a way I can do this ? Maybe use a cursor
> in a way I don't know that allows me to specify that it should use the
> second result set ?
> TIA
> Steve
>
|||Thanks Vyas,
That's just what I needed !
Steve
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:e$QDx6vaEHA.1356@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> See sp_helpfile in SQL Server Books Online. You could save the results of
> this proc to a temporary table, using the INSERT...EXEC syntax.
> --
> Vyas, MVP (SQL Server)
> http://vyaskn.tripod.com/
>
> "Steve W" <lsl@.btconnect.com> wrote in message
> news:uFi%23DyvaEHA.3664@.TK2MSFTNGP12.phx.gbl...
database.[vbcol=seagreen]
> with
into[vbcol=seagreen]
> a
cursor
>
|||Hi,
You can also use the below solution. This gives filenames for all the
databases directly.
select substring(db_name(dbid),1,30) as database_name,filename from
sysaltfiles
-- to put the result into a temp table
select substring(db_name(dbid),1,30) as database_name,filename into #temp
from sysaltfiles
select * from #temp
Thanks
Hari
MCDBA
"Steve W" <lsl@.btconnect.com> wrote in message
news:eRxuf9vaEHA.3352@.TK2MSFTNGP12.phx.gbl...[vbcol=seagreen]
> Thanks Vyas,
> That's just what I needed !
> Steve
>
> "Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
> news:e$QDx6vaEHA.1356@.TK2MSFTNGP09.phx.gbl...
of[vbcol=seagreen]
> database.
one
> into
> cursor
>

How to get file path of datafiles etc

I know I can use sp_helpdb <db name> to get information about a database.
This SP gives me 2 result sets - one with name, owner, size etc and one with
a list of the files that make up the db.
What I want to do is get the filename column of the second result set into a
variable in my script. Is there a way I can do this ? Maybe use a cursor
in a way I don't know that allows me to specify that it should use the
second result set ?
TIA
SteveSee sp_helpfile in SQL Server Books Online. You could save the results of
this proc to a temporary table, using the INSERT...EXEC syntax.
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Steve W" <lsl@.btconnect.com> wrote in message
news:uFi%23DyvaEHA.3664@.TK2MSFTNGP12.phx.gbl...
> I know I can use sp_helpdb <db name> to get information about a database.
> This SP gives me 2 result sets - one with name, owner, size etc and one
with
> a list of the files that make up the db.
> What I want to do is get the filename column of the second result set into
a
> variable in my script. Is there a way I can do this ? Maybe use a cursor
> in a way I don't know that allows me to specify that it should use the
> second result set ?
> TIA
> Steve
>|||Thanks Vyas,
That's just what I needed !
Steve
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:e$QDx6vaEHA.1356@.TK2MSFTNGP09.phx.gbl...
> See sp_helpfile in SQL Server Books Online. You could save the results of
> this proc to a temporary table, using the INSERT...EXEC syntax.
> --
> Vyas, MVP (SQL Server)
> http://vyaskn.tripod.com/
>
> "Steve W" <lsl@.btconnect.com> wrote in message
> news:uFi%23DyvaEHA.3664@.TK2MSFTNGP12.phx.gbl...
> > I know I can use sp_helpdb <db name> to get information about a
database.
> > This SP gives me 2 result sets - one with name, owner, size etc and one
> with
> > a list of the files that make up the db.
> >
> > What I want to do is get the filename column of the second result set
into
> a
> > variable in my script. Is there a way I can do this ? Maybe use a
cursor
> > in a way I don't know that allows me to specify that it should use the
> > second result set ?
> >
> > TIA
> >
> > Steve
> >
> >
>|||Hi,
You can also use the below solution. This gives filenames for all the
databases directly.
select substring(db_name(dbid),1,30) as database_name,filename from
sysaltfiles
-- to put the result into a temp table
select substring(db_name(dbid),1,30) as database_name,filename into #temp
from sysaltfiles
select * from #temp
Thanks
Hari
MCDBA
"Steve W" <lsl@.btconnect.com> wrote in message
news:eRxuf9vaEHA.3352@.TK2MSFTNGP12.phx.gbl...
> Thanks Vyas,
> That's just what I needed !
> Steve
>
> "Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
> news:e$QDx6vaEHA.1356@.TK2MSFTNGP09.phx.gbl...
> > See sp_helpfile in SQL Server Books Online. You could save the results
of
> > this proc to a temporary table, using the INSERT...EXEC syntax.
> > --
> > Vyas, MVP (SQL Server)
> > http://vyaskn.tripod.com/
> >
> >
> > "Steve W" <lsl@.btconnect.com> wrote in message
> > news:uFi%23DyvaEHA.3664@.TK2MSFTNGP12.phx.gbl...
> > > I know I can use sp_helpdb <db name> to get information about a
> database.
> > > This SP gives me 2 result sets - one with name, owner, size etc and
one
> > with
> > > a list of the files that make up the db.
> > >
> > > What I want to do is get the filename column of the second result set
> into
> > a
> > > variable in my script. Is there a way I can do this ? Maybe use a
> cursor
> > > in a way I don't know that allows me to specify that it should use the
> > > second result set ?
> > >
> > > TIA
> > >
> > > Steve
> > >
> > >
> >
> >
>

How to get file path of datafiles etc

I know I can use sp_helpdb <db name> to get information about a database.
This SP gives me 2 result sets - one with name, owner, size etc and one with
a list of the files that make up the db.
What I want to do is get the filename column of the second result set into a
variable in my script. Is there a way I can do this ? Maybe use a cursor
in a way I don't know that allows me to specify that it should use the
second result set ?
TIA
SteveSee sp_helpfile in SQL Server Books Online. You could save the results of
this proc to a temporary table, using the INSERT...EXEC syntax.
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Steve W" <lsl@.btconnect.com> wrote in message
news:uFi%23DyvaEHA.3664@.TK2MSFTNGP12.phx.gbl...
> I know I can use sp_helpdb <db name> to get information about a database.
> This SP gives me 2 result sets - one with name, owner, size etc and one
with
> a list of the files that make up the db.
> What I want to do is get the filename column of the second result set into
a
> variable in my script. Is there a way I can do this ? Maybe use a cursor
> in a way I don't know that allows me to specify that it should use the
> second result set ?
> TIA
> Steve
>|||Thanks Vyas,
That's just what I needed !
Steve
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:e$QDx6vaEHA.1356@.TK2MSFTNGP09.phx.gbl...
> See sp_helpfile in SQL Server Books Online. You could save the results of
> this proc to a temporary table, using the INSERT...EXEC syntax.
> --
> Vyas, MVP (SQL Server)
> http://vyaskn.tripod.com/
>
> "Steve W" <lsl@.btconnect.com> wrote in message
> news:uFi%23DyvaEHA.3664@.TK2MSFTNGP12.phx.gbl...
database.[vbcol=seagreen]
> with
into[vbcol=seagreen]
> a
cursor[vbcol=seagreen]
>|||Hi,
You can also use the below solution. This gives filenames for all the
databases directly.
select substring(db_name(dbid),1,30) as database_name,filename from
sysaltfiles
-- to put the result into a temp table
select substring(db_name(dbid),1,30) as database_name,filename into #temp
from sysaltfiles
select * from #temp
Thanks
Hari
MCDBA
"Steve W" <lsl@.btconnect.com> wrote in message
news:eRxuf9vaEHA.3352@.TK2MSFTNGP12.phx.gbl...
> Thanks Vyas,
> That's just what I needed !
> Steve
>
> "Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
> news:e$QDx6vaEHA.1356@.TK2MSFTNGP09.phx.gbl...
of[vbcol=seagreen]
> database.
one[vbcol=seagreen]
> into
> cursor
>