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


Job - Scheduled update table in another databaes nightly - please review and comment on script /...


Job - Scheduled update table in another databaes nightly - please review and comment on script / process

Author
Message
Mile Higher Than Sea Level
Mile Higher Than Sea Level
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1016 Visits: 465
Please review Newbie's code and plan: Comments welcome
SQL 2008 - Database name FOO FOO has 2 databases DBT and GIS Only Table in GIS is GISDaily
Database GIS has SQL Server Security for the GIS dept username/Password set to DBO
The GISDaily will be set to a scheduled task to run. The GIS_Info is a Table (or view) that will be modified (e.g. new fields) from time-to-time
Each night - the GISDaily will be destroyed and rebuilt. The GIS Database will have GISDaily re-built each night.

USE DBT;
GO
IF OBJECT_ID('dbo.GIS.GISDaily', 'U') IS NOT NULL
DROP TABLE dbo.GIS.GISDaily;
GO
ALTER DATABASE GIS SET RECOVERY BULK_LOGGED;
GO
SELECT * INTO GIS.dbo.GISDaily
FROM GIS_Info
GO
ALTER DATABASE GIS SET RECOVERY Simple;
GO

-- the idea is to rebuild GISDaily from a view in DBT. The GIS dept will provide changes in the DBT view.
-- The UN/PW for the SQL server is only used for the GIS DB. So, the rebuilt table will be available to them.
Sean Pearce
Sean Pearce
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4218 Visits: 3436
Firstly, it should be GIS.dbo.GISDaily and not dbo.GIS.GISDaily.
Secondly you can leave the database in simple recovery.

USE DBT;
GO

IF OBJECT_ID('GIS.dbo.GISDaily', 'U') IS NOT NULL
DROP TABLE GIS.dbo.GISDaily;
GO

SELECT *
INTO GIS.dbo.GISDaily
FROM GIS_Info
GO





The SQL Guy @ blogspot

@SeanPearceSQL

About Me
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