Showing posts with label components. Show all posts
Showing posts with label components. Show all posts

Monday, March 12, 2012

Script for Transfering Database Diagram

I've been trying to get the scripts posted earlier to the group by
Clay Beatty to work properly. Using the three components he posted, I
have managed to get a new SP generated. However, when I paste this
scrip into a new copy of the original database (different name, same
structure as a test), I get an Invalid Object Name for the temp table
#PersistedVariables.

Has anyone run into something like this before? Or used the scripts I
mentioned successfully? Help would be appreciated. The resulting
section of code causing the error is posted below. This is running on
SQL-Server 2000.

Tim Pascoe

CREATE PROCEDURE [dbo].[Create Diagrams] AS

----------------------
-- Database Diagram Reconstruction Script
----------------------
-- Created on: 2004-07-19 11:54:43.327
-- From Database: CABIN
-- By User: dbo
--
-- This SQL Script was designed to reconstruct a set ofdatabase
-- diagrams, by repopulating the system table dtproperties, inthe
-- current database, with values which existed at the timethis
-- script was created. Typically, this script would be createdto
-- backup a set of database diagrams, or to package up thosediagrams
-- for deployment to another database.
--
-- Minimally, all that needs to be done to recreate the target
-- diagrams is to run this script. There are several options,
-- however, which may be modified, to customize the diagrams tobe
-- produced. Changing these options is as simple as modifyingthe
-- initial values for a set of variables, which are definedimmediately
-- following these comments. They are:
--
-- Variable Name Description
-- --------------------
-- @.TargetDatabase This varchar variable will establishthe
-- target database, within which thediagrams
-- will be reconstructed. This variableis
-- initially set to database name fromwhich
the
-- script was built, but it may bemodified as
-- required. A valid database namemust be
-- specified.
--
-- @.DropExistingDiagrams This bit variable is initially setset to a
-- value of zero (0), which indicatesthat any
-- existing diagrams in the target
-- to be preserved. By setting thisvalue to
-- one (1), any existing diagrams inthe target
-- database will be dropped prior to
-- reconstruction. Zero and One are theonly
-- valid values for the variable.
--
-- @.DiagramSuffix This varchar variable will be usedto append
-- to the original diagram names, asthey
-- existed at the time they werescripted. This
-- variable is initially set to take onthe
-- value of the current date/time,although it
-- may be modified as required. Anempty
string
-- value would effectively turn off thediagram
-- suffix option.
--
----------------------

SET NOCOUNT ON

-- User Settable Options
--------
Declare @.TargetDatabase varchar (128)
Declare @.DropExistingDiagrams bit
Declare @.DiagramSuffix varchar (50)

-- Initialize User Settable Options
-----------
SET @.TargetDatabase = 'CABIN2'
SET @.DropExistingDiagrams = 0
SET @.DiagramSuffix = ' ' + Convert(varchar(23), GetDate(),121)

----------------------
-- END OF USER MODIFIABLE SECTION - MAKE NO CHANGES TO THELOGIC BELOW
--
----------------------

-- Setting Target database and clearing dtproperties, ifindicated
--------------------
Exec('USE ' + @.TargetDatabase)
IF (@.DropExistingDiagrams = 1)
TRUNCATE TABLE dtproperties

-- Creating Temp Table to persist specific variables
-- between Transact SQL batches (between GO statements)
-----------------
IF EXISTS(SELECT 1
FROM tempdb..sysobjects
WHERE name like '%#PersistedVariables%'
AND xtype = 'U')
DROP TABLE #PersistedVariables
CREATE TABLE #PersistedVariables (VariableName varchar (50)NOT NULL,
VariableValue varchar (50)NOT NULL)
ON [PRIMARY]
ALTER TABLE #PersistedVariables ADD CONSTRAINT
PK_PersistedVariables PRIMARY KEY CLUSTERED
(VariableName) ON [PRIMARY]

-- Persist @.DiagramSuffix
--------
INSERT INTO #PersistedVariables VALUES ('DiagramSuffix',
@.DiagramSuffix)
GO

-- Insert a new dtproperties row
----------
INSERT INTO dtproperties (objectid,
property,
value,
uvalue,
lvalue,
version)
VALUES (0,
'DtgSchemaOBJECT',
null,
null,
null,
0)
DELETE #PersistedVariables
WHERE VariableName = 'NextObjectid'
INSERT INTO #PersistedVariables VALUES ('NextObjectid',
Convert(varchar(15),
@.@.IDENTITY))
Declare @.NextObjectid int
SELECT @.NextObjectid = Convert(int, VariableValue)
FROM #PersistedVariables
WHERE VariableName = 'NextObjectid'
UPDATE dtproperties
SET Objectid = @.NextObjectid
WHERE id = @.NextObjectid
GO

-- Insert a new dtproperties row
----------
Declare @.NextObjectid int
SELECT @.NextObjectid = Convert(int, VariableValue)
FROM #PersistedVariables
WHERE VariableName = 'NextObjectid'
INSERT INTO dtproperties (objectid,
property,
value,
uvalue,
lvalue,
version)
VALUES (@.NextObjectid,
'DtgSchemaGUID',
'{EA3E6268-D998-11CE-9454-00AA00A3F36E}',
'{EA3E6268-D998-11CE-9454-00AA00A3F36E}',
null,
0)
GO

-- Insert a new dtproperties row
----------
Declare @.DiagramSuffix varchar (50)
SELECT @.DiagramSuffix = Convert(varchar (50), VariableValue)
FROM #PersistedVariables
WHERE VariableName = 'DiagramSuffix'
Declare @.NextObjectid int
SELECT @.NextObjectid = Convert(int, VariableValue)
FROM #PersistedVariables
WHERE VariableName = 'NextObjectid'
INSERT INTO dtproperties (objectid,
property,
value,
uvalue,
lvalue,
version)
VALUES (@.NextObjectid,
'DtgSchemaNAME',
'CABIN Detail' + @.DiagramSuffix,
'CABIN Detail'+ @.DiagramSuffix,
null,
1)
GO

-- Insert a new dtproperties row
----------
Declare @.NextObjectid int
SELECT @.NextObjectid = Convert(int, VariableValue)
FROM #PersistedVariables
WHERE VariableName = 'NextObjectid'
INSERT INTO dtproperties (objectid,
property,
value,
uvalue,
lvalue,
version)
VALUES (@.NextObjectid,
'DtgDSRefBYTES',
'2502',
'2502',
null,
12)
GO

-- Insert a new dtproperties row
----------
Declare @.NextObjectid int
SELECT @.NextObjectid = Convert(int, VariableValue)
FROM #PersistedVariables
WHERE VariableName = 'NextObjectid'
INSERT INTO dtproperties (objectid,
property,
value,
uvalue,
lvalue,
version)
VALUES (@.NextObjectid,
'DtgDSRefDATA',
null,
null,
cast('0' as varbinary(10)),
12)
GO
--SNIP--"Tim Pascoe" <tim.pascoe@.cciw.ca> wrote in message
news:19555f2b.0407190833.4b0a5ae5@.posting.google.c om...
> I've been trying to get the scripts posted earlier to the group by
> Clay Beatty to work properly. Using the three components he posted, I
> have managed to get a new SP generated. However, when I paste this
> scrip into a new copy of the original database (different name, same
> structure as a test), I get an Invalid Object Name for the temp table
> #PersistedVariables.
> Has anyone run into something like this before? Or used the scripts I
> mentioned successfully? Help would be appreciated. The resulting
> section of code causing the error is posted below. This is running on
> SQL-Server 2000.
> Tim Pascoe

<snip
I'm not familiar with this code, but it appears to start out as a procedure,
and then turns into a series of TSQL batches. When the first GO command is
reached, this executes the CREATE PROCEDURE statement with the code up to
that point as the procedure text. Subsequent sections between GO commands
are executed as independent batches, however since the #PersistedVariables
table is created in the procedure, not in a batch, it doesn't exist when the
batches try to find it.

I can't really say more than that, as I don't know how this procedure is
intended to be used - you may want to review the original posting again. By
the way, a procedure name with a space in it is probably a bad idea, as many
tools (and many human beings) don't always handle that very well.

Simon

Friday, March 9, 2012

Script files failed to load error

Hi all,

I have a package with a number of script components. All are set "PreCompile=True".

Within a Sequence Container I have a set of five script tasks each followed by an Execute Process Task. Each pair is linked but the five pairs are independent (hope this makes sense).

The first pair executed successfully but the other four all failed with the "Script files failed to load" error.

Anyone have a clue why this might happen or what I might change to solve the problem?

The package is scheduled under SS Agent so I'm currently thinking of taking these steps out of SSIS and putting them into the job. Not ideal but at least I can have some confidence that it will work.

Any suggestions would be very welcome.

Cheers,

Andrew

Go into the script tasks, click "Design Script...", when VBA opens close it down again.

This will *hopefully* recompile the binary code and the problem *should* go away.

If not, there may be something else going on here.

-Jamie

|||

Hmmm,

Thanks for the suggestion. I'll give it a try but I suspect it may be a "something else". If I copy the dtsx package to another machine and run it through dtexec the problem doesn't occur.

It's probably more of a concern if this does work as it suggests that within a package there's no guarantee that a given script component is compiled when the package is deployed.

Andrew

|||

Did you ever get a resolution to this problem?

I am having a similiar issue. I am executing several SSIS packages from within a SSIS package Script file (PreCompileScriptIntoBinaryCode=True) based on package names in a table.

What makes my problem similiar is, it is always the 3rd package called that fails with this error. These packages also have Script files (PreCompileScriptIntoBinaryCode=True).

This happens not only when called from Sql Server Agent, but also when run from within BIDS.

|||Anyone figure this out? My script task is failing only when run under SQL Server Agent as a scheduled job.|||

I don't have a resolution but it hasn't happened lately.

Sorry not to be more helpful.

I'm not sure what's going to happen when the package needs changing.

Andrew

|||

In my case, it seemed that I had a stop for debugging within my script. When the package was running on the server it was failing with this error message, no problems when running on the client. So check you don't have any breaks within your script and it may do the trick!.

Panos.

|||

For what it's worth, I had the exact problem. Only failing under Sql Agent with "Script files failed to load".

I took Jamie's advice above, opened my script tasks and I clicked save. Redeployed the package and it worked.

I am running on 64-bit itaniums w/sp1. Also, I am running the job under the 'sa' account.

|||

I had the same problem and followed Jamie suggestion. It worked!!

I had copied sever scripts to my package and had not opened and saved to auto-recompile.

Thanks Jamie!

Script files failed to load error

Hi all,

I have a package with a number of script components. All are set "PreCompile=True".

Within a Sequence Container I have a set of five script tasks each followed by an Execute Process Task. Each pair is linked but the five pairs are independent (hope this makes sense).

The first pair executed successfully but the other four all failed with the "Script files failed to load" error.

Anyone have a clue why this might happen or what I might change to solve the problem?

The package is scheduled under SS Agent so I'm currently thinking of taking these steps out of SSIS and putting them into the job. Not ideal but at least I can have some confidence that it will work.

Any suggestions would be very welcome.

Cheers,

Andrew

Go into the script tasks, click "Design Script...", when VBA opens close it down again.

This will *hopefully* recompile the binary code and the problem *should* go away.

If not, there may be something else going on here.

-Jamie

|||

Hmmm,

Thanks for the suggestion. I'll give it a try but I suspect it may be a "something else". If I copy the dtsx package to another machine and run it through dtexec the problem doesn't occur.

It's probably more of a concern if this does work as it suggests that within a package there's no guarantee that a given script component is compiled when the package is deployed.

Andrew

|||

Did you ever get a resolution to this problem?

I am having a similiar issue. I am executing several SSIS packages from within a SSIS package Script file (PreCompileScriptIntoBinaryCode=True) based on package names in a table.

What makes my problem similiar is, it is always the 3rd package called that fails with this error. These packages also have Script files (PreCompileScriptIntoBinaryCode=True).

This happens not only when called from Sql Server Agent, but also when run from within BIDS.

|||Anyone figure this out? My script task is failing only when run under SQL Server Agent as a scheduled job.|||

I don't have a resolution but it hasn't happened lately.

Sorry not to be more helpful.

I'm not sure what's going to happen when the package needs changing.

Andrew

|||

In my case, it seemed that I had a stop for debugging within my script. When the package was running on the server it was failing with this error message, no problems when running on the client. So check you don't have any breaks within your script and it may do the trick!.

Panos.

|||

For what it's worth, I had the exact problem. Only failing under Sql Agent with "Script files failed to load".

I took Jamie's advice above, opened my script tasks and I clicked save. Redeployed the package and it worked.

I am running on 64-bit itaniums w/sp1. Also, I am running the job under the 'sa' account.

|||

I had the same problem and followed Jamie suggestion. It worked!!

I had copied sever scripts to my package and had not opened and saved to auto-recompile.

Thanks Jamie!

Script files failed to load error

Hi all,

I have a package with a number of script components. All are set "PreCompile=True".

Within a Sequence Container I have a set of five script tasks each followed by an Execute Process Task. Each pair is linked but the five pairs are independent (hope this makes sense).

The first pair executed successfully but the other four all failed with the "Script files failed to load" error.

Anyone have a clue why this might happen or what I might change to solve the problem?

The package is scheduled under SS Agent so I'm currently thinking of taking these steps out of SSIS and putting them into the job. Not ideal but at least I can have some confidence that it will work.

Any suggestions would be very welcome.

Cheers,

Andrew

Go into the script tasks, click "Design Script...", when VBA opens close it down again.

This will *hopefully* recompile the binary code and the problem *should* go away.

If not, there may be something else going on here.

-Jamie

|||

Hmmm,

Thanks for the suggestion. I'll give it a try but I suspect it may be a "something else". If I copy the dtsx package to another machine and run it through dtexec the problem doesn't occur.

It's probably more of a concern if this does work as it suggests that within a package there's no guarantee that a given script component is compiled when the package is deployed.

Andrew

|||

Did you ever get a resolution to this problem?

I am having a similiar issue. I am executing several SSIS packages from within a SSIS package Script file (PreCompileScriptIntoBinaryCode=True) based on package names in a table.

What makes my problem similiar is, it is always the 3rd package called that fails with this error. These packages also have Script files (PreCompileScriptIntoBinaryCode=True).

This happens not only when called from Sql Server Agent, but also when run from within BIDS.

|||Anyone figure this out? My script task is failing only when run under SQL Server Agent as a scheduled job.|||

I don't have a resolution but it hasn't happened lately.

Sorry not to be more helpful.

I'm not sure what's going to happen when the package needs changing.

Andrew

|||

In my case, it seemed that I had a stop for debugging within my script. When the package was running on the server it was failing with this error message, no problems when running on the client. So check you don't have any breaks within your script and it may do the trick!.

Panos.

|||

For what it's worth, I had the exact problem. Only failing under Sql Agent with "Script files failed to load".

I took Jamie's advice above, opened my script tasks and I clicked save. Redeployed the package and it worked.

I am running on 64-bit itaniums w/sp1. Also, I am running the job under the 'sa' account.

|||

I had the same problem and followed Jamie suggestion. It worked!!

I had copied sever scripts to my package and had not opened and saved to auto-recompile.

Thanks Jamie!

Script files failed to load error

Hi all,

I have a package with a number of script components. All are set "PreCompile=True".

Within a Sequence Container I have a set of five script tasks each followed by an Execute Process Task. Each pair is linked but the five pairs are independent (hope this makes sense).

The first pair executed successfully but the other four all failed with the "Script files failed to load" error.

Anyone have a clue why this might happen or what I might change to solve the problem?

The package is scheduled under SS Agent so I'm currently thinking of taking these steps out of SSIS and putting them into the job. Not ideal but at least I can have some confidence that it will work.

Any suggestions would be very welcome.

Cheers,

Andrew

Go into the script tasks, click "Design Script...", when VBA opens close it down again.

This will *hopefully* recompile the binary code and the problem *should* go away.

If not, there may be something else going on here.

-Jamie

|||

Hmmm,

Thanks for the suggestion. I'll give it a try but I suspect it may be a "something else". If I copy the dtsx package to another machine and run it through dtexec the problem doesn't occur.

It's probably more of a concern if this does work as it suggests that within a package there's no guarantee that a given script component is compiled when the package is deployed.

Andrew

|||

Did you ever get a resolution to this problem?

I am having a similiar issue. I am executing several SSIS packages from within a SSIS package Script file (PreCompileScriptIntoBinaryCode=True) based on package names in a table.

What makes my problem similiar is, it is always the 3rd package called that fails with this error. These packages also have Script files (PreCompileScriptIntoBinaryCode=True).

This happens not only when called from Sql Server Agent, but also when run from within BIDS.

|||Anyone figure this out? My script task is failing only when run under SQL Server Agent as a scheduled job.|||

I don't have a resolution but it hasn't happened lately.

Sorry not to be more helpful.

I'm not sure what's going to happen when the package needs changing.

Andrew

|||

In my case, it seemed that I had a stop for debugging within my script. When the package was running on the server it was failing with this error message, no problems when running on the client. So check you don't have any breaks within your script and it may do the trick!.

Panos.

|||

For what it's worth, I had the exact problem. Only failing under Sql Agent with "Script files failed to load".

I took Jamie's advice above, opened my script tasks and I clicked save. Redeployed the package and it worked.

I am running on 64-bit itaniums w/sp1. Also, I am running the job under the 'sa' account.

|||

I had the same problem and followed Jamie suggestion. It worked!!

I had copied sever scripts to my package and had not opened and saved to auto-recompile.

Thanks Jamie!