RE: To the guru's a problem with DB data integrety[Scanned]

RE: To the guru's a problem with DB data integrety[Scanned]

 

  


Why create these tables and put info in them which can by found in the system tables ?

-----Original Message-----
From: Stephen Mitchell [mailto:mssqldba-ezmlmshield-x29029530.[Email address protected]
Sent: Thursday, September 30, 2004 17:16 PM
To: LazyDBA Discussion
Subject: To the guru's a problem with DB data integrety[Scanned]

Hi all,
I'm a relatively junior DBA whose tasks so far have been monitoring, backups and troubleshooting ECT. Basic stuff I'm sure you'll agree, but have now taken a role where I have to write scripts, something I have had little experience in, but have done ok so far. My problem is I am trying to do the most basic task and it's failing in every attempt. I wouldn't ask (especially after the UNION thread, but I have genuinely looked in as many sources as I know of, and have no other DBA's here to ask. I don't want to be force fed the answer, just pointers to where I'm going wrong.
My goal is to have a monitor DB with 5 tables: ServerName, DBName, Fileinfo, and history.
I created the monitoring DB and the [ServerName] table, which is populated from the data in sys servers. It has 2 columns serverid and servername. I then created the [DBName] table with 2 columns serverid and Dbname. This went fine.
I wrote a cursor to loop through all servers in the Servername table to populate the DBName table (taking the serverID from the query) but this fails and I know my logic is all wrong.
insert DBName (DBname)
select name from @server.master.dbo.sysdatabases
UPDate DBNAME set serverid =
(select serverid from tempdb.dbo.servername sn where sn.servername = @server)
I want to populate this table having the Serverid as the relationship, but they never seem to match????
Any assistance would be appreciated, I know you are all very busy.

Kind Regards

Steve M





Cofunds Limited, 1st Floor, 1 Minster Court, Mincing Lane,
London EC3R 7AA. Registered in England and Wales
No 3965289. Authorised and regulated by Financial Services Authority. Phone: 0207 398 7000, or visit our website at www.cofunds.co.uk.
Telephone calls may be recorded for monitoring purposes.
**************************************************************************
The information contained in this message may be CONFIDENTIAL and is intended for the addressee only. Any unauthorised use, dissemination of the information, or copying of this message is prohibited. If you are not the addressee, please notify the sender immediately by return e-mail and delete this message.

Although this e-mail and any attachments are believed to be free of
any virus, or other defect which might affect any computer or system
into which they are received and opened, it is the responsibility of
the recipient to ensure that they are virus free and no responsibility
is accepted by Cofunds for any loss or damage from receipt or use thereof.
**************************************************************************



---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]




MS Sql Server LazyDBA home page