SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server 2000


SQL Server 2000

Author
Message
Tsinelas
Tsinelas
SSC-Enthusiastic
SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)

Group: General Forum Members
Points: 171 Visits: 221
Hi SQL Masters,

Greetings!

Do you have any idea where to pull these fields from sql server 2000?
Server Name DB Name File Type file_size MB File Name Disk Drive Drive Free Space (MB) SQLVersion




Thank you and Regards,

Tsinelas
enriquezreyjoseph
enriquezreyjoseph
SSC-Enthusiastic
SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)

Group: General Forum Members
Points: 187 Visits: 191
Tsinelas (10/21/2013)
Hi SQL Masters,

Greetings!

Do you have any idea where to pull these fields from sql server 2000?
Server Name DB Name File Type file_size MB File Name Disk Drive Drive Free Space (MB) SQLVersion




Thank you and Regards,

Tsinelas


Hi Slippers,

Can you give us more details please??...Salamat:-)

~Sam Pinto Regards..
Tsinelas
Tsinelas
SSC-Enthusiastic
SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)

Group: General Forum Members
Points: 171 Visits: 221
Master Sam Pinto,

Salamat sa reply Smile

Gusto ko sana makita ung filegroup total size in MB and filegroup free space in MB ng Databases kasama na rin ung file location via T-SQL Smile

Sa SQL 2005 to 2008 kac dba, makikita sila sa sys.databases, sys.sysfiles & sys.sysfilegroups. Sa SQL 2000 kac d ko alam kung saan ko huhugutin ung infos Sad
Beatrix Kiddo
Beatrix Kiddo
SSCertifiable
SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)

Group: General Forum Members
Points: 7148 Visits: 4852
Is that Tagalog :-)? Can you write it again in English for us?

I'm not quite sure if this is what you want, but...

- for server name: SELECT @@SERVERNAME
- for database name of current database: select DB_NAME()
Tsinelas
Tsinelas
SSC-Enthusiastic
SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)

Group: General Forum Members
Points: 171 Visits: 221
Hi Master SSC Journeyman,

Just asking if you guys have an idea on how to pull records of database information on SQL 2000, as of now on sql 2005 and 2008 i can get those information on sys.databases, sys.sysfiles & sys.sysfilegroups.

Any idea sir?



Thank you and Best Regards,

Tsinelas
John Mitchell-245523
John Mitchell-245523
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: General Forum Members
Points: 36010 Visits: 16700
dbo.sysdatabases, dbo.sysfiles, dbo.sysfilegroups.

John
Tsinelas
Tsinelas
SSC-Enthusiastic
SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)

Group: General Forum Members
Points: 171 Visits: 221
Hi John,


Thank you very much!! Smile I made this one. Smile




Create table #DInfo([DDrive] nChar(1) Null, [MB_Free] Float Null)
Insert #DInfo EXEC master..xp_fixeddrives

DECLARE @vDBName nVarchar(200)
DECLARE @vSTR nVarchar(4000)

DECLARE InvDBs CURSOR FOR
SELECT rtrim(ltrim(NAME))
FROM dbo.sysdatabases d

OPEN InvDBs
FETCH InvDBs into @vDBName

WHILE @@FETCH_STATUS = 0
BEGIN
SET @vSTR = 'USE ' + QUOTENAME(@vDBName) + CHAR(10)
SET @vSTR = @vSTR + '
SELECT
convert(nvarchar(128), serverproperty(''ServerName'')) As ''Server Name'',
DB_NAME() As ''DB Name'',
Case when SUBSTRING(a.filename,LEN(a.filename) -2,3) = ''mdf'' then ''Data'' else ''Log'' end As ''File Type'',
convert(decimal(12,2),round(a.size/128.000,2)) as file_size,
a.filename As ''File Name'',
Substring(a.filename,1,1) As ''Disk Drive'',
c.MB_Free As ''Drive Free Space (MB)'',
@@Version As ''SQLVersion''
FROM dbo.sysfiles a LEFT OUTER JOIN dbo.sysfilegroups b
ON a.groupid = b.groupid
INNER JOIN #DInfo c on Substring(a.filename,1,1) = c.DDrive
'
EXEC (@vSTR)
FETCH InvDBs into @vDBName
END

CLOSE InvDBs
DEALLOCATE InvDBs

DROP TABLE #DInfo








Tsinelas
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search