Re: Create package in place of script
From: Aaron Prohaska (REMOVE_THISmohaaron_at_gmail.com)
Date: 09/28/04
- Next message: Allan Mitchell: "Re: Execute DTS in VB.net program"
- Previous message: Allan Mitchell: "Re: .ini file size limitations in Dynamic Properties Task"
- In reply to: Ilya Margolin: "Re: Create package in place of script"
- Next in thread: Allan Mitchell: "Re: Create package in place of script"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Allan Mitchell: "Re: Execute DTS in VB.net program"
- Previous message: Allan Mitchell: "Re: .ini file size limitations in Dynamic Properties Task"
- In reply to: Ilya Margolin: "Re: Create package in place of script"
- Next in thread: Allan Mitchell: "Re: Create package in place of script"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|