Re: Create package in place of script

From: Aaron Prohaska (REMOVE_THISmohaaron_at_gmail.com)
Date: 09/28/04


Date: Tue, 28 Sep 2004 11:47:58 -0700

Ilya Margolin wrote:
> Aaron,
>
> Start a new package and include the script into Execute SQL task.
>
> Ilya
>
> "Aaron Prohaska" <REMOVE_THISmohaaron@gmail.com> wrote in message
> news:u41snTOpEHA.3464@TK2MSFTNGP14.phx.gbl...
>
>>Can anyone give me some direction in how to make a package to do what
>>this script is doing? I have been checking the dts related web sites and
>>groups and haven't found what I need to understand how to do this.
>>
>>BEGIN TRANSACTION
>>
>>DECLARE
>>@ULogin varchar(50),
>>@UPassword varchar(50),
>>@UFirstName varchar(25),
>>@UMiddleName varchar(25),
>>@ULastName varchar(25),
>>@UCreateDate datetime,
>>@UUpdateDate datetime,
>>@UHeight decimal (5,2),
>>@UMeas3 decimal (5,2),
>>@UMeas4 decimal (5,2),
>>@UMeas2 decimal (5,2),
>>@UMeas1 decimal (5,2),
>>@UFlex tinyint,
>>@UWeight decimal (5,2),
>>@UShoeSize decimal (5,2),
>>@NewUserID int,
>>@IsError bit
>>
>>SET @IsError = 0
>>
>>DECLARE csrUsers CURSOR STATIC LOCAL FORWARD_ONLY FOR
>>SELECT
>>UID, UFirstName, UMiddleName, ULastName, UCreateDate, UUpdateDate,
>>--// Data For Users And Customers Table
>>ULogin, UPassword, --// Data For UserLogin Table
>>UHeight, UMeas3, UMeas4, UMeas2, UMeas1, UFlex, UWeight, UShoeSize --//
>>FROM
>>[WS1].[dbo].[Users]
>>WHERE
>>(ULogin IS NOT NULL AND ULogin <> '')
>>AND
>>(UPassword IS NOT NULL AND UPassword <> '')
>>AND
>>(UFirstName IS NOT NULL AND UFirstName <> '')
>>AND
>>(ULastName IS NOT NULL AND ULastName <> '')
>>
>>open csrUsers
>>
>>FETCH NEXT
>>FROM
>>csrUsers
>>INTO
>>--// Data For Users And Customers Table
>>@UFirstName, @UMiddleName, @ULastName, @UCreateDate, @UUpdateDate,
>>--// Data For UserLogin Table
>>@ULogin, @UPassword,
>>--// Data For UserFit Table
>>@UHeight, @UMeas3, @UMeas4, @UMeas2, @UMeas1, @UFlex, @UWeight, @UShoeSize
>>
>>WHILE @@FETCH_STATUS = 0
>>BEGIN
>>--// Insert Into Users Table
>>INSERT INTO [WS2].[dbo].[Users]
>>([FirstName], [MiddleName], [LastName], [CreateDate], [UpdateDate])
>>VALUES
>>(@UFirstName, @UMiddleName, @ULastName, @UCreateDate, @UUpdateDate)
>>
>>SET @NewUserID = SCOPE_IDENTITY()
>>
>>--// Insert Into Customers Table
>>INSERT INTO [WS2].[dbo].[Customers]
>>([CustomerID])
>>VALUES
>>(@NewUserID)
>>
>>--// Insert Into UserLogin
>>INSERT INTO [WS2].[dbo].[UserLogin]
>>([UserID], [Username], [Password])
>>VALUES
>>(@NewUserID, @ULogin, @UPassword)
>>
>>--// Insert Into EmailAddresses
>>INSERT INTO [WS2].[dbo].[EmailAddresses]
>>([IsPrimary], [UserID], [Email])
>>VALUES
>>(1, @NewUserID, @ULogin)
>>
>>IF (@UHeight IS NULL) BEGIN
>>SET @UHeight = 0
>>END
>>IF (@UMeas3 IS NULL) BEGIN
>>SET @UMeas3 = 0
>>END
>>IF (@UMeas4 IS NULL) BEGIN
>>SET @UMeas4 = 0
>>END
>>IF (@UMeas2 IS NULL) BEGIN
>>SET @UMeas2 = 0
>>END
>>IF (@UMeas1 IS NULL) BEGIN
>>SET @UMeas1 = 0
>>END
>>IF (@UFlex IS NULL) BEGIN
>>SET @UFlex = 0
>>END
>>IF (@UWeight IS NULL) BEGIN
>>SET @UWeight = 0
>>END
>>IF (@UShoeSize IS NULL) BEGIN
>>SET @UShoeSize = 0
>>END
>>
>>IF (@UHeight > 0 AND @UMeas3 > 0 AND @UMeas4 > 0 AND @UMeas2 > 0 AND
>>@UMeas1 > 0 AND @UFlex > 0 AND @UWeight > 0 AND @UShoeSize > 0) BEGIN
>>--// Insert Into UserFit
>>INSERT INTO [WS2].[dbo].[UserFit]
>>([UserID], [Height], [SternumNotch], [Inseam], [ArmLength],
>>[ShoulderWidth], [Flexibility], [Weight], [ShoeSize])
>>VALUES
>>(@NewUserID, @UHeight, @UMeas3, @UMeas4, @UMeas2, @UMeas1, @UFlex,
>>@UWeight, @UShoeSize)
>>END
>>
>>FETCH NEXT
>>FROM
>>csrUsers
>>INTO
>>--// Data For Users And Customers Table
>>@UFirstName, @UMiddleName, @ULastName, @UCreateDate, @UUpdateDate,
>>--// Data For UserLogin Table
>>@ULogin, @UPassword,
>>--// Data For UserFit Table
>>@UHeight, @UMeas3, @UMeas4, @UMeas2, @UMeas1, @UFlex, @UWeight, @UShoeSize
>>END
>>
>>CLOSE csrUsers
>>DEALLOCATE csrUsers
>>
>>IF( @@ERROR <> 0 ) SET @IsError = 1
>>
>>IF( @IsError = 0 )
>> COMMIT TRANSACTION
>>ELSE
>> ROLLBACK TRANSACTION
>>GO
>>
>>thanks,
>>
>>Aaron
>
>
>

I could drop the script into an execute sql task, though what I really
was looking to do is create a package to replace the script. So I'm
really wondering if its possible to create a package that will select
and insert data in the same way that this script does it.

Thanks for the response,

Aaron



Relevant Pages

  • Installation of software, and security. . .
    ... installation in Windows and various package managers. ... A setup.exe program coded by some third party such as Real Networks ... A .msi Microsoft Installer package is unpacked, and a script coded by ...
    (Bugtraq)
  • Re: goto &Package::func destroying @_?!
    ... >>script, but maybe the description will trigger something from someone.... ... code the 'Core' package uses another package as a base that has a custom ... package Foo; ... if it really is a problem with goto&. ...
    (comp.lang.perl.misc)
  • Tcl application deployment
    ... Tcl interpretator and any packages it uses. ... As far as I know, no OS provides way to load dynamic libraries using ... There is no way to fix bugs in some package used by application, ... all script files which come with application should be ...
    (comp.lang.tcl)
  • Re: ActiveX Script errors suppressed
    ... I've never actually tried to call GetExecutionErrorInfo in an ActiveX ... >etc. ActiveX Script only has the variant type. ... >change the variant to a true string. ... Dynamic Properties task instead in the main package. ...
    (microsoft.public.sqlserver.dts)
  • QUESTION: shared libraries
    ... how would I create a package easy-to-install for a new user? ... we could use a script to install the package. ... I have seen some scripts executing from a ... Gouvernement du Canada / Government of Canada ...
    (comp.os.linux.development.apps)

Loading