Showing posts with label dts. Show all posts
Showing posts with label dts. Show all posts

Monday, March 26, 2012

Package won't run correctly when called

I have a stiuation where I need to import data from Excel and of course I'm using DTS to do so. Because the spreadsheets have a variety of datatypes in them, I have to make sure that DTS recognizes certain rows as INT so they will import properly, to do so I add 5 rows of 1's to the top lines of the individual sheets in the correct columns. After the 1's are entered I import to staging tables and then into the production tables. The package itself is run from a job and the job is called by a stored procedure running sp_start_job. Here is a sample of the ActiveX script I am using to alter the spreadsheets:

*****************************************************************
Function Main()

On Error Resume Next

Dim Excel_Application
Dim Excel_WorkBook
Dim Excel_WorkSheet

Dim sFilename
Dim sSheetName

sFilename = "\\Share\LCS Database Information - Data Test.xls"
sSheetName = "Experience Spreadsheet"
Set Excel_Application = CreateObject("Excel.Application")

Excel_Application.DisplayAlerts = False

' Open the workbook specified
Set Excel_WorkBook = Excel_Application.Workbooks.Open(sFilename)

Excel_WorkBook.Worksheets(sSheetName).Activate

FOR x = 2 TO 6 STEP 1
FOR i = 1 TO 5 STEP 1
Excel_WorkBook.WorkSheets(sSheetName).Cells(i,x).Value = 1
NEXT
NEXT
*************************************************************************

It does this to 3 sheets and then the import steps run.

Now, when I execute the package in Enterprise Manager it works exactly as I want. However when I run it through the stored procedure, the ActiveX doesn't run properly. My stored proc looks essentiall like this:

****************************************************************************
--Creat TEMP table for the DTS package to store values from the spreadsheet
EXEC pCreateTEMPTables

IF @.@.ERROR <> 0
BEGIN
SET @.Segment = 1
GOTO sqlerror
END

--Run the DTS package that will pull data into temp tables so the individual --data points can be used to search up keys
EXEC msdb.dbo.sp_start_job
@.job_name = 'LCSRunDTS'

EXEC more.procs
****************************************************************************

One thing about the spreadsheets is that they have links in them wanring messages get thrown up during the ActiveX script about updating the links. I tried to turn them off but one message, "One or more links can't be updated" which comes up if you click "Update" on the previous warning or supress warnings, just won't go away.

Any ideas? Thanks
Well, I got the first problem above figured out. When I ran the package directly from Enterprise Manager, the ActiveX object was created on my local system and used Excel there to do what it needed to. When I tried to run the package on the server which didn't have Excel installed, my script failed. My new solution (as soon as it works) is to use WshRemote to run the script to alter the spreadsheets using a computer with Excel installed. The following script works when run from my PC but fails with the message "Error Source = Microsoft VBScript runtime error, Error Description: Permission Denied" when run as part of the DTS package called from a stored procedure via dtsrun:
--
Dim Controller, RemoteScript
Set Controller = CreateObject("WSHController")
Set RemoteScript = Controller.CreateScript("\\Server\Share\ExcelAdd1s.vbs", "MyLocalPC")
RemoteScript.Execute

Being new to the DBA world, I need some help with permissions. Is it that the SQL Server account doesn't have access to the shared drive, or to my PC? Where can I look to see what user is running the DTS package? Are there any questions that I'm not asking that I should be? Any help would be appreciated.|||When yuo run the package from EM directly your logged in account needs to have permission to the share. When it runs from an agent job the SQL Agent account must have permission to do the same thing, it must be to a UNC share and not a mapped drive

Tuesday, March 20, 2012

Package designer- feature pack

after installing the Microsoft SQL Server 2000 DTS Designer Com feature pack and then restarting my management studio, I still cannot see or edit my dts packages. I also tried editing them in the integration services consule but no luck there. I see them under the msdb and have no option to edit them.

Has anyone got this utility to work?

Thanks,
David

From Management Studio, connect to the server where you have your .dts packages saved, go to Management->Legacy->Data Transformation Service, when you see the list of dts packages, right click on one and choose Open. It works for me fine.

You can not use Integration Service designer to open or edit your .dts packages, that's expected.

Thanks

wenyang

|||Im guessing that your opening the packages stored on a sql 2000 server and not a 2005. I tried moving them to my 2005 server and opening them, but am not seeing them.

Thanks for the response.|||

Yes, I was connecting to a sql2000 instance from a sql2005 server, and everything worked fine that way. I now also tried in your way, I agree there maybe an issue here connecting to a .dts package saved on a sql2005 server, which I am observing right now. However, here is a work around for you to at least make your scenario work

At your box where Sql2005 is installed

1. Connect to a sql2000 instance first to see that the .dts package openned without a problem (that's what I got).

2. In that legacy designer UI, choose save your .dts package as "Structured Storage File" (instead of saving it to a sql server) to the local box.

3. Then in SqlServer2005 Management Studio, go to Management | Legacy | Data Transformation Service, right click and choose "Open package file" pointing to that .dts file.

That works for me and hope the same for you. If not, please let me know what you get and I'll follow up.

Thanks

Wenyang

|||

thanks much. I just got done going through the same scenario..

Cheers.

Friday, March 9, 2012

Ownership of the DTS

How can we change the ownership of a DTS package ?
Thanks
Hi,
In MSDB database there is a undocumented procedure
sp_reassign_dtspackageowner
Details are in below link:-
http://www.sqldts.com/default.aspx?6,105,212,0,1
Thanks
Hari
MCDBA
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2089b01c459b4$88bd28e0$a301280a@.phx.gbl...
> How can we change the ownership of a DTS package ?
> Thanks
|||Peter
EXEC msdb.dbo.sp_DTSReplaceOwner
@.old_owner='Peter',
@.new_owner='sa'
Also
http://support.microsoft.com/default...b;EN-US;247052
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2089b01c459b4$88bd28e0$a301280a@.phx.gbl...
> How can we change the ownership of a DTS package ?
> Thanks

Ownership of the DTS

How can we change the ownership of a DTS package ?
ThanksHi,
In MSDB database there is a undocumented procedure
sp_reassign_dtspackageowner
Details are in below link:-
http://www.sqldts.com/default.aspx?6,105,212,0,1
Thanks
Hari
MCDBA
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2089b01c459b4$88bd28e0$a301280a@.phx
.gbl...
> How can we change the ownership of a DTS package ?
> Thanks|||Peter
EXEC msdb.dbo.sp_DTSReplaceOwner
@.old_owner='Peter',
@.new_owner='sa'
Also
http://support.microsoft.com/defaul...kb;EN-US;247052
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2089b01c459b4$88bd28e0$a301280a@.phx
.gbl...
> How can we change the ownership of a DTS package ?
> Thanks

Ownership of the DTS

How can we change the ownership of a DTS package ?
ThanksHi,
In MSDB database there is a undocumented procedure
sp_reassign_dtspackageowner
Details are in below link:-
http://www.sqldts.com/default.aspx?6,105,212,0,1
--
Thanks
Hari
MCDBA
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2089b01c459b4$88bd28e0$a301280a@.phx.gbl...
> How can we change the ownership of a DTS package ?
> Thanks|||Peter
EXEC msdb.dbo.sp_DTSReplaceOwner
@.old_owner='Peter',
@.new_owner='sa'
Also
http://support.microsoft.com/default.aspx?scid=kb;EN-US;247052
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2089b01c459b4$88bd28e0$a301280a@.phx.gbl...
> How can we change the ownership of a DTS package ?
> Thanks

Saturday, February 25, 2012

Overwrite SQL exported Excel sheet with new data

Hi,

I have set up a DTS package to export data to an excel sheet. If I schedule it the data appends to the exisitng data in the sheet.

How do I overwrite the data or update the data in sheet so that I may schedule a fresh updated copy to be sent to same file?

Thanks

Quote:

Originally Posted by daywho

Hi,

I have set up a DTS package to export data to an excel sheet. If I schedule it the data appends to the exisitng data in the sheet.

How do I overwrite the data or update the data in sheet so that I may schedule a fresh updated copy to be sent to same file?

Thanks


In the create table task, add a drop table :

DROP TABLE `myexcelsheetname`
GO

CREATE TABLE `myexcelsheetname` (
`tDescription` LongText ,
`tIdentifier` VarChar (16) ,
`tUpdateDate` DateTime
)

Overwrite Excel spreadsheet

Hi,

I have a DTS package that imports a file with data,
performs several checks,
puts all invalid rows in a table,
exports the table to a excel spreadsheet.

My problem is that it appends the data every time. I want it to overwrite the existing spreadsheet. I can't find any option for that.

I use the "Transform Data Task" to do this.

Any suggestions?Do an EXECUTE PROCESS Task and supply a DELETE Command...

But I didn't think it did an append...|||I had the same problem this week. I made a template of the excel sheet, selected the columns needed and created a named range on the excel sheet, and added it as a linked server. Once it's linked like this you can treat the named range like a table and use a delete from statement to clear the sheet.

Run this command from QA to make the excel sheet a linked server, 'excelsource' can be any name you want to give the connection.

sp_addlinkedserver 'excelsource', 'jet 4.0', 'Microsoft.Jet.OLEDB.4.0',
'c:\temp\filename.xls', null, 'excel 5.0'

If the named range on the excel sheet is also named excelsource use

delete from excelsource...excelsource