Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Thursday, March 29, 2012

DTS From SQL Server 2000 to Btrieve

Hi,

This is my 1st time out here so please bear with me.

I am trying to transfer data from a SQL Server 2000 DB to a Btrieve file. I have everything set up and used the Import/Export Utility to create the DTS Package. Everything seems to wotk fine until I hit a field in the SQL Server 2000 DB that has a signle quote (') in a name field. Btrieve seems to bomb on that record. If I take the single quote out, it works fine until the next name with a single quote. What can I do to get these records imported?

Thanks much,
Rayuse the following function

ltrim(replace(columnname,'''',''))

you are replacing a single quote in a column with a null and you trimming that with ltrim function.......|||Thanks for the info, but I actually need the single quote. I have set my transformation to change the signle quote into a ~ (tilde). My C program the changes the ~ back to a single quote when updating the main data file from the temp one SQL Server updated.

Ray Fantasia

DTS file name to include System Date/Time

We have an application group that wants to pull date from SQL Server and write it to text file on the server. They want the file format to be 12100_YYYMMDDHHMM.fr1 for one set of data, 12100_YYYMMDDHHMM.fr2 for a second set...and so on. The '12100' is fixed, but the rest of the file name will always have to include the system date/time. Is there an easy way to do this within a DTS package (when writing to the output file)?

I would really appreciate help on this. Thank you.Hi

You can set a global variable to the fixed part at the start of the process. This should help http://www.sqldts.com/default.aspx?200 although you want to set a global variable rather than a local one.

John
"steven virnig" <pezguy@.mn.rr.com> wrote in message news:o1ovd.114089$ye4.34831@.twister.rdc-kc.rr.com...
We have an application group that wants to pull date from SQL Server and write it to text file on the server. They want the file format to be 12100_YYYMMDDHHMM.fr1 for one set of data, 12100_YYYMMDDHHMM.fr2 for a second set...and so on. The '12100' is fixed, but the rest of the file name will always have to include the system date/time. Is there an easy way to do this within a DTS package (when writing to the output file)?

I would really appreciate help on this. Thank you.

Tuesday, March 27, 2012

DTS Fails

This summary is not available. Please click here to view the post.

DTS Export to Excel Too many Recs?

Hi All,

I'm trying to export around 115,000 rows from ms sql 2000 into Excel 2000, using the manual process. I just need this one time dump.

I am able to successfully export around +- 65,000 rows, but the operation fails after that.

I need to be able to get all the rows out, so using TOP obviously doesn't work.

Is there some "version" or modified way to use TOP to get...say, rows 65,000 to 90,000 then 90,001 to 115,000 ?

This would'nt be an issue if the db I'm working with was MySQL...I'd just use the LIMIT function and pull out 3 different chucks. Is there anything similar to LIMIT...or something converse to TOP in MS SQL? Or perhaps another way to dump the table then export it all (or in portions) into Excel?

Thanks!You need to have a key field(s) that you can sort on. So lets say you have a unique id like excel_id numbered from 1 to 120000:

select top 65000 ... from table order by excel_id
select top 55000 ... from table order by excel_id desc|||If you want an inner subset like 65000-90000 then you would use something like:

select top 25000 ... from (select top 55000 from table order by field desc) order by field|||If you do have a key then you can use KEY BETWEEN 65001 and 90000, etc. ...and if you were using MySQL we wouldn't have even bothered to look at the question...In short, - DON'T USE IT!|||Are you using a standard DTS data pump to export the data? Or are you using something else?

If you are using a data pump then why not take care of the problem programaticly? Select all the records and keep an internal counter so you know when you reach 65000 and when you do change your target to a new spreadsheet zero the counter and continue on...

Just a thought,...|||There are plenty of other ways to do this as well, it just depends on the requirements for your export...|||With a programmatic solution, your performance will suffer. Allow the database to do its job.|||Thanks for all the replies/suggestions!

There is no key field.
I couldn't find a solution, so I just dumped the data, opened it in textpad, cut out three chunks (~35,000 rows) and imported them into 3 diff .xls files.

Interesting enough for those in the anti MySQL crowd ... chances are, this very forum almost certainly uses MySQL. I say this for two reasons. 1. PHP server side scripting. 2. This is a vBulletin forum.
Not to mention the growing interest in open source products vs proprietary!

Cheers!

DTS Export to Excel

I am using a DTS created by the Export Wizard to send data to an Excel
spreadsheet. The problem is that each time the DTS is run, the data gets
appended to the spreadsheet, rather than replaced. I used the Drop and
Create Destination Table option on the Transformation window.
I found an earlier post regarding this same problem. The suggestion was to
use the Delete option in the Transformation window of the wizard. I rebuilt
the DTS based on that idea, but get an error message about "Deleting data in
a linked table is not supported by this ISAM".
Can someone offer some ideas on how to get the data replaced in the Excel
spreadsheet?
Thanks.Hi Martin
"Martin" wrote:
> I am using a DTS created by the Export Wizard to send data to an Excel
> spreadsheet. The problem is that each time the DTS is run, the data gets
> appended to the spreadsheet, rather than replaced. I used the Drop and
> Create Destination Table option on the Transformation window.
> I found an earlier post regarding this same problem. The suggestion was to
> use the Delete option in the Transformation window of the wizard. I rebuilt
> the DTS based on that idea, but get an error message about "Deleting data in
> a linked table is not supported by this ISAM".
> Can someone offer some ideas on how to get the data replaced in the Excel
> spreadsheet?
> Thanks.
I usually want to rename the spreadsheets when I load data into excel,
therefore I copy/rename a template spreadsheet and then populate that using
activeX scripts see http://www.sqldts.com/292.aspx
If required you can also change the destination filename in a similar way to
http://www.sqldts.com/200.aspx
John|||I cannot rename the spreadsheet because it is tied into other processes. I
need to replace the data that already exists in the spreadsheet.
If it helps, I did some research since my original posting and here is what
I found:
1) When DTS creates the range name in the spreadsheet, it is only the
headings of the data. The data itself is not included in the range name.
Somewhere, the last line of data is being tracked versus the last line in the
range name. Subsequent runs of the DTS appear to be using the last line of
data, not the last line in the range.
2) If I manually expand the range name to include the last line of data,
then rerun the DTS, the new data is still appended to the bottom of the old
data. The old data is cleared leaving blank rows, but the new data is still
appended to the bottom; again based on the last line of data. The area
covered by the range name returns to being just the headings.
Could the fact that Excel is not installed on the machine running the DTS
have any bearing?
Thanks.
"John Bell" wrote:
> Hi Martin
> "Martin" wrote:
> > I am using a DTS created by the Export Wizard to send data to an Excel
> > spreadsheet. The problem is that each time the DTS is run, the data gets
> > appended to the spreadsheet, rather than replaced. I used the Drop and
> > Create Destination Table option on the Transformation window.
> >
> > I found an earlier post regarding this same problem. The suggestion was to
> > use the Delete option in the Transformation window of the wizard. I rebuilt
> > the DTS based on that idea, but get an error message about "Deleting data in
> > a linked table is not supported by this ISAM".
> >
> > Can someone offer some ideas on how to get the data replaced in the Excel
> > spreadsheet?
> >
> > Thanks.
> I usually want to rename the spreadsheets when I load data into excel,
> therefore I copy/rename a template spreadsheet and then populate that using
> activeX scripts see http://www.sqldts.com/292.aspx
> If required you can also change the destination filename in a similar way to
> http://www.sqldts.com/200.aspx
> John|||Hi Martin
"Martin" wrote:
> I cannot rename the spreadsheet because it is tied into other processes. I
> need to replace the data that already exists in the spreadsheet.
> If it helps, I did some research since my original posting and here is what
> I found:
> 1) When DTS creates the range name in the spreadsheet, it is only the
> headings of the data. The data itself is not included in the range name.
> Somewhere, the last line of data is being tracked versus the last line in the
> range name. Subsequent runs of the DTS appear to be using the last line of
> data, not the last line in the range.
> 2) If I manually expand the range name to include the last line of data,
> then rerun the DTS, the new data is still appended to the bottom of the old
> data. The old data is cleared leaving blank rows, but the new data is still
> appended to the bottom; again based on the last line of data. The area
> covered by the range name returns to being just the headings.
> Could the fact that Excel is not installed on the machine running the DTS
> have any bearing?
> Thanks.
>
I don't think it is the lack of excel that does this, as this also occurs on
my tests. You could drop the worksheet http://www.sqldts.com/245.aspx and if
you package re-creates it the net effect should be ok.
John|||I'm sorry to be picky, but I cannot drop the worksheet either. It is part of
a complicated multi-tab file.
Also, the link you provided indicates that Excel must be installed on the
machine running the DTS. I do not believe I can get that approved.
Thanks.
"John Bell" wrote:
> Hi Martin
> "Martin" wrote:
> > I cannot rename the spreadsheet because it is tied into other processes. I
> > need to replace the data that already exists in the spreadsheet.
> >
> > If it helps, I did some research since my original posting and here is what
> > I found:
> > 1) When DTS creates the range name in the spreadsheet, it is only the
> > headings of the data. The data itself is not included in the range name.
> > Somewhere, the last line of data is being tracked versus the last line in the
> > range name. Subsequent runs of the DTS appear to be using the last line of
> > data, not the last line in the range.
> >
> > 2) If I manually expand the range name to include the last line of data,
> > then rerun the DTS, the new data is still appended to the bottom of the old
> > data. The old data is cleared leaving blank rows, but the new data is still
> > appended to the bottom; again based on the last line of data. The area
> > covered by the range name returns to being just the headings.
> >
> > Could the fact that Excel is not installed on the machine running the DTS
> > have any bearing?
> >
> > Thanks.
> >
> I don't think it is the lack of excel that does this, as this also occurs on
> my tests. You could drop the worksheet http://www.sqldts.com/245.aspx and if
> you package re-creates it the net effect should be ok.
> John|||Hi Martin,May I spend your some time to look at the post? Please help
me about St16c550's driver.
You can find the post at:
http://groups.google.com/group/microsoft.public.development.device.drivers/browse_thread/thread/5d0d28403902b7d9/2b95633f7391968c?lnk=raot#2b95633f7391968c|||Hi Martin
"Martin" wrote:
> I'm sorry to be picky, but I cannot drop the worksheet either. It is part of
> a complicated multi-tab file.
> Also, the link you provided indicates that Excel must be installed on the
> machine running the DTS. I do not believe I can get that approved.
> Thanks.
>
If that is the case I don't think you can't do it with DTS.
I haven't tried an ODBC connection to see if that behaved differently.
If you could use SSIS for this, then it would work!
John

DTS Export to Excel

I am using a DTS created by the Export Wizard to send data to an Excel
spreadsheet. The problem is that each time the DTS is run, the data gets
appended to the spreadsheet, rather than replaced. I used the Drop and
Create Destination Table option on the Transformation window.
I found an earlier post regarding this same problem. The suggestion was to
use the Delete option in the Transformation window of the wizard. I rebuilt
the DTS based on that idea, but get an error message about "Deleting data in
a linked table is not supported by this ISAM".
Can someone offer some ideas on how to get the data replaced in the Excel
spreadsheet?
Thanks.
Hi Martin
"Martin" wrote:

> I am using a DTS created by the Export Wizard to send data to an Excel
> spreadsheet. The problem is that each time the DTS is run, the data gets
> appended to the spreadsheet, rather than replaced. I used the Drop and
> Create Destination Table option on the Transformation window.
> I found an earlier post regarding this same problem. The suggestion was to
> use the Delete option in the Transformation window of the wizard. I rebuilt
> the DTS based on that idea, but get an error message about "Deleting data in
> a linked table is not supported by this ISAM".
> Can someone offer some ideas on how to get the data replaced in the Excel
> spreadsheet?
> Thanks.
I usually want to rename the spreadsheets when I load data into excel,
therefore I copy/rename a template spreadsheet and then populate that using
activeX scripts see http://www.sqldts.com/292.aspx
If required you can also change the destination filename in a similar way to
http://www.sqldts.com/200.aspx
John
|||I cannot rename the spreadsheet because it is tied into other processes. I
need to replace the data that already exists in the spreadsheet.
If it helps, I did some research since my original posting and here is what
I found:
1) When DTS creates the range name in the spreadsheet, it is only the
headings of the data. The data itself is not included in the range name.
Somewhere, the last line of data is being tracked versus the last line in the
range name. Subsequent runs of the DTS appear to be using the last line of
data, not the last line in the range.
2) If I manually expand the range name to include the last line of data,
then rerun the DTS, the new data is still appended to the bottom of the old
data. The old data is cleared leaving blank rows, but the new data is still
appended to the bottom; again based on the last line of data. The area
covered by the range name returns to being just the headings.
Could the fact that Excel is not installed on the machine running the DTS
have any bearing?
Thanks.
"John Bell" wrote:

> Hi Martin
> "Martin" wrote:
>
> I usually want to rename the spreadsheets when I load data into excel,
> therefore I copy/rename a template spreadsheet and then populate that using
> activeX scripts see http://www.sqldts.com/292.aspx
> If required you can also change the destination filename in a similar way to
> http://www.sqldts.com/200.aspx
> John
|||Hi Martin
"Martin" wrote:

> I cannot rename the spreadsheet because it is tied into other processes. I
> need to replace the data that already exists in the spreadsheet.
> If it helps, I did some research since my original posting and here is what
> I found:
> 1) When DTS creates the range name in the spreadsheet, it is only the
> headings of the data. The data itself is not included in the range name.
> Somewhere, the last line of data is being tracked versus the last line in the
> range name. Subsequent runs of the DTS appear to be using the last line of
> data, not the last line in the range.
> 2) If I manually expand the range name to include the last line of data,
> then rerun the DTS, the new data is still appended to the bottom of the old
> data. The old data is cleared leaving blank rows, but the new data is still
> appended to the bottom; again based on the last line of data. The area
> covered by the range name returns to being just the headings.
> Could the fact that Excel is not installed on the machine running the DTS
> have any bearing?
> Thanks.
>
I don't think it is the lack of excel that does this, as this also occurs on
my tests. You could drop the worksheet http://www.sqldts.com/245.aspx and if
you package re-creates it the net effect should be ok.
John
|||I'm sorry to be picky, but I cannot drop the worksheet either. It is part of
a complicated multi-tab file.
Also, the link you provided indicates that Excel must be installed on the
machine running the DTS. I do not believe I can get that approved.
Thanks.
"John Bell" wrote:

> Hi Martin
> "Martin" wrote:
> I don't think it is the lack of excel that does this, as this also occurs on
> my tests. You could drop the worksheet http://www.sqldts.com/245.aspx and if
> you package re-creates it the net effect should be ok.
> John
|||Hi Martin,May I spend your some time to look at the post? Please help
me about St16c550's driver.
You can find the post at:
http://groups.google.com/group/microsoft.public.development.device.drivers/browse_thread/thread/5d0d28403902b7d9/2b95633f7391968c?lnk=raot#2b95633f7391968c
|||Hi Martin
"Martin" wrote:

> I'm sorry to be picky, but I cannot drop the worksheet either. It is part of
> a complicated multi-tab file.
> Also, the link you provided indicates that Excel must be installed on the
> machine running the DTS. I do not believe I can get that approved.
> Thanks.
>
If that is the case I don't think you can't do it with DTS.
I haven't tried an ODBC connection to see if that behaved differently.
If you could use SSIS for this, then it would work!
John

DTS Export to Excel

I am using a DTS created by the Export Wizard to send data to an Excel
spreadsheet. The problem is that each time the DTS is run, the data gets
appended to the spreadsheet, rather than replaced. I used the Drop and
Create Destination Table option on the Transformation window.
I found an earlier post regarding this same problem. The suggestion was to
use the Delete option in the Transformation window of the wizard. I rebuilt
the DTS based on that idea, but get an error message about "Deleting data in
a linked table is not supported by this ISAM".
Can someone offer some ideas on how to get the data replaced in the Excel
spreadsheet?
Thanks.Hi Martin
"Martin" wrote:

> I am using a DTS created by the Export Wizard to send data to an Excel
> spreadsheet. The problem is that each time the DTS is run, the data gets
> appended to the spreadsheet, rather than replaced. I used the Drop and
> Create Destination Table option on the Transformation window.
> I found an earlier post regarding this same problem. The suggestion was t
o
> use the Delete option in the Transformation window of the wizard. I rebui
lt
> the DTS based on that idea, but get an error message about "Deleting data
in
> a linked table is not supported by this ISAM".
> Can someone offer some ideas on how to get the data replaced in the Excel
> spreadsheet?
> Thanks.
I usually want to rename the spreadsheets when I load data into excel,
therefore I copy/rename a template spreadsheet and then populate that using
activeX scripts see http://www.sqldts.com/292.aspx
If required you can also change the destination filename in a similar way to
http://www.sqldts.com/200.aspx
John|||I cannot rename the spreadsheet because it is tied into other processes. I
need to replace the data that already exists in the spreadsheet.
If it helps, I did some research since my original posting and here is what
I found:
1) When DTS creates the range name in the spreadsheet, it is only the
headings of the data. The data itself is not included in the range name.
Somewhere, the last line of data is being tracked versus the last line in th
e
range name. Subsequent runs of the DTS appear to be using the last line of
data, not the last line in the range.
2) If I manually expand the range name to include the last line of data,
then rerun the DTS, the new data is still appended to the bottom of the old
data. The old data is cleared leaving blank rows, but the new data is still
appended to the bottom; again based on the last line of data. The area
covered by the range name returns to being just the headings.
Could the fact that Excel is not installed on the machine running the DTS
have any bearing?
Thanks.
"John Bell" wrote:

> Hi Martin
> "Martin" wrote:
>
> I usually want to rename the spreadsheets when I load data into excel,
> therefore I copy/rename a template spreadsheet and then populate that usin
g
> activeX scripts see http://www.sqldts.com/292.aspx
> If required you can also change the destination filename in a similar way
to
> http://www.sqldts.com/200.aspx
> John|||Hi Martin
"Martin" wrote:

> I cannot rename the spreadsheet because it is tied into other processes.
I
> need to replace the data that already exists in the spreadsheet.
> If it helps, I did some research since my original posting and here is wha
t
> I found:
> 1) When DTS creates the range name in the spreadsheet, it is only the
> headings of the data. The data itself is not included in the range name.
> Somewhere, the last line of data is being tracked versus the last line in
the
> range name. Subsequent runs of the DTS appear to be using the last line o
f
> data, not the last line in the range.
> 2) If I manually expand the range name to include the last line of data,
> then rerun the DTS, the new data is still appended to the bottom of the ol
d
> data. The old data is cleared leaving blank rows, but the new data is sti
ll
> appended to the bottom; again based on the last line of data. The area
> covered by the range name returns to being just the headings.
> Could the fact that Excel is not installed on the machine running the DTS
> have any bearing?
> Thanks.
>
I don't think it is the lack of excel that does this, as this also occurs on
my tests. You could drop the worksheet http://www.sqldts.com/245.aspx and if
you package re-creates it the net effect should be ok.
John|||I'm sorry to be picky, but I cannot drop the worksheet either. It is part o
f
a complicated multi-tab file.
Also, the link you provided indicates that Excel must be installed on the
machine running the DTS. I do not believe I can get that approved.
Thanks.
"John Bell" wrote:

> Hi Martin
> "Martin" wrote:
>
> I don't think it is the lack of excel that does this, as this also occurs
on
> my tests. You could drop the worksheet http://www.sqldts.com/245.aspx and
if
> you package re-creates it the net effect should be ok.
> John|||Hi Martin,May I spend your some time to look at the post? Please help
me about St16c550's driver.
You can find the post at:
http://groups.google.com/group/micr...b95633f7391968c|||Hi Martin
"Martin" wrote:

> I'm sorry to be picky, but I cannot drop the worksheet either. It is part
of
> a complicated multi-tab file.
> Also, the link you provided indicates that Excel must be installed on the
> machine running the DTS. I do not believe I can get that approved.
> Thanks.
>
If that is the case I don't think you can't do it with DTS.
I haven't tried an ODBC connection to see if that behaved differently.
If you could use SSIS for this, then it would work!
John

Sunday, March 25, 2012

DTS Error: transaction exceeded allotted time

I receive this error "The transaction has exceeded the allotted time" in a
pop-up sometimes when I use DTS. This happens in an randomly way, when I run a package, when I try to open a package or save it, and normally happens when the machine is very busy with another process.
The packages are saved as Meta Data Services Packages.
I'm running SQL Server 2000 with SP2, and Windows 2000 Advanced
Server with SP2.this may help u

resource timeout Option
Use the resource timeout option to specify the number of seconds to wait for a resource to be released. resource timeout controls the overall time out of asynchronous input/output (I/O) operations. The default setting is 10; any operation that takes longer than 10 seconds to complete results in a time-out warning.

Do not set this value too low or resources may time out in an unrealistically short time. Increase this value if the Microsoft SQL Server error log shows a lot of logwrite or bufwait time-out warnings; this reduces the frequency with which these errors are generated. Allowing a transaction to take more time is often better than allowing it to fail.

resource timeout is an advanced option. If you are using the sp_configure system stored procedure to change the setting, you can change resource timeout only when show advanced options is set to 1. The setting takes effect immediately (without a server stop and restart).

DTS Error 1st Time

Hi All,
I am executing a DTS Package from with in a Stored Procedure Like:
SET @.CMD = 'DTSRUN /S ' + @.SERVERNAME + ' /E /N ' + @.DTSNAME + ' ' +
@.GLOBLEVARIABLELIST + ''
EXECUTE @.ERR_NUM = master..xp_cmdshell @.CMD
The 1st Time when I call Stored procedure from My Code. It is Not Executing
the Package. But 2nd time onward that is executing the package and doing all
what ever i want to do.
What is happening in 1st time so that the package is fails? Is that setting
any environment in 1st time and executing the Package from 2nd time onward.
I am too Confused. Need Help.
Thanks
Prabhat
You've posted this at least 6 times already. Have you considered posting to
the DTS group, or having some patience?
http://www.aspfaq.com/
(Reverse address to reply.)
"Prabhat" <not_a_mail@.hotmail.com> wrote in message
news:#pWPr#kSEHA.1368@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I am executing a DTS Package from with in a Stored Procedure Like:
> SET @.CMD = 'DTSRUN /S ' + @.SERVERNAME + ' /E /N ' + @.DTSNAME + ' ' +
> @.GLOBLEVARIABLELIST + ''
> EXECUTE @.ERR_NUM = master..xp_cmdshell @.CMD
> The 1st Time when I call Stored procedure from My Code. It is Not
Executing
> the Package. But 2nd time onward that is executing the package and doing
all
> what ever i want to do.
> What is happening in 1st time so that the package is fails? Is that
setting
> any environment in 1st time and executing the Package from 2nd time
onward.
> I am too Confused. Need Help.
> Thanks
> Prabhat
>
>

DTS Error 1st Time

Hi All,
I am executing a DTS Package from with in a Stored Procedure Like:
SET @.CMD = 'DTSRUN /S ' + @.SERVERNAME + ' /E /N ' + @.DTSNAME + ' ' +
@.GLOBLEVARIABLELIST + ''
EXECUTE @.ERR_NUM = master..xp_cmdshell @.CMD
The 1st Time when I call Stored procedure from My Code. It is Not Executing
the Package. But 2nd time onward that is executing the package and doing all
what ever i want to do.
What is happening in 1st time so that the package is fails? Is that setting
any environment in 1st time and executing the Package from 2nd time onward.
I am too Confused. Need Help.
Thanks
PrabhatYou've posted this at least 6 times already. Have you considered posting to
the DTS group, or having some patience?
http://www.aspfaq.com/
(Reverse address to reply.)
"Prabhat" <not_a_mail@.hotmail.com> wrote in message
news:#pWPr#kSEHA.1368@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I am executing a DTS Package from with in a Stored Procedure Like:
> SET @.CMD = 'DTSRUN /S ' + @.SERVERNAME + ' /E /N ' + @.DTSNAME + ' ' +
> @.GLOBLEVARIABLELIST + ''
> EXECUTE @.ERR_NUM = master..xp_cmdshell @.CMD
> The 1st Time when I call Stored procedure from My Code. It is Not
Executing
> the Package. But 2nd time onward that is executing the package and doing
all
> what ever i want to do.
> What is happening in 1st time so that the package is fails? Is that
setting
> any environment in 1st time and executing the Package from 2nd time
onward.
> I am too Confused. Need Help.
> Thanks
> Prabhat
>
>sql

DTS Error 1st Time

Hi All,
I am executing a DTS Package from with in a Stored Procedure Like:
SET @.CMD = 'DTSRUN /S ' + @.SERVERNAME + ' /E /N ' + @.DTSNAME + ' ' +
@.GLOBLEVARIABLELIST + ''
EXECUTE @.ERR_NUM = master..xp_cmdshell @.CMD
The 1st Time when I call Stored procedure from My Code. It is Not Executing
the Package. But 2nd time onward that is executing the package and doing all
what ever i want to do.
What is happening in 1st time so that the package is fails? Is that setting
any environment in 1st time and executing the Package from 2nd time onward.
I am too Confused. Need Help.
Thanks
PrabhatYou've posted this at least 6 times already. Have you considered posting to
the DTS group, or having some patience?
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Prabhat" <not_a_mail@.hotmail.com> wrote in message
news:#pWPr#kSEHA.1368@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I am executing a DTS Package from with in a Stored Procedure Like:
> SET @.CMD = 'DTSRUN /S ' + @.SERVERNAME + ' /E /N ' + @.DTSNAME + ' ' +
> @.GLOBLEVARIABLELIST + ''
> EXECUTE @.ERR_NUM = master..xp_cmdshell @.CMD
> The 1st Time when I call Stored procedure from My Code. It is Not
Executing
> the Package. But 2nd time onward that is executing the package and doing
all
> what ever i want to do.
> What is happening in 1st time so that the package is fails? Is that
setting
> any environment in 1st time and executing the Package from 2nd time
onward.
> I am too Confused. Need Help.
> Thanks
> Prabhat
>
>

Wednesday, March 21, 2012

DTS completion time jump

Hi,
I have a DTS package that runs 4 other packages on a nightly basis. This
package usually takes about 2 hours to run, but ocasionally it jumps to
around 5 hours to complete. There have not been any changes to the
parameters or coding. It is the same process that causes this each time
which is a cursor run strored procedure. There have not been any huge jumps
in the number of records in the table or changes to the source data that
would cause the cursor to take longer to run through. This seems to be
intermittent, I can not easily check to see if something else in the network
on that server is happening since it is a customer site. Would you think
that something outside of the package is affecting this since it only happen
s
once in a while (about once a w or so), like I mentioned - backups, serve
r
processes, other jobs etc.? I just don't know where to look if I have not
changed anything within my package.
Thanks,
PatriceThe are many reasons why performance can change over time. One is job
contention, where multiple jobs are running at the same time. The following
will dump a listing of jobs, when they started and ended out of the
msdb.dbo.sysjobhistory system table, and store it in a temporary table:
select t2.[name], t2.job_start, DATEADD(ss,DATEDIFF(ss,'1980-01-01',
'1980-01-01 ' + t2.job_duration),t2.job_start) AS job_end
INTO #jobsched
FROM (
select t1.[name],
CAST(
start_date + ' ' + LEFT(t1.start_time,2) + ':' +
SUBSTRING(t1.start_time,3,2) + ':' + RIGHT(t1.start_time,2) AS datetime
) AS "job_start",
LEFT(t1.job_duration,2) + ':' + SUBSTRING(t1.job_duration,3,2) + ':' +
RIGHT(t1.job_duration,2) AS job_duration
FROM
(
select
j.[name],
LEFT(CAST(h.run_date AS char(8)), 4) + '-' + SUBSTRING(CAST(h.run_date AS
char(8)),5,2) + '-' + RIGHT(CAST(h.run_date AS char(8)), 2) AS "start_date",
REPLICATE('0', 6 - LEN(h.run_time)) + CAST(h.run_time AS varchar(6)) AS
"start_time",
REPLICATE('0', 6 - LEN(h.run_duration)) + CAST(h.run_duration AS varchar(6))
"job_duration"
from msdb.dbo.sysjobhistory h INNER JOIN msdb.dbo.sysjobschedules j
ON h.job_id = j.job_id
WHERE h.step_id = 0
) t1
) t2
SELECT * FROM #jobsched
You could take a look at the output of the above and "eyeball" it for job
conflicts, or you could try (*untested*)
SELECT t1.[name], t1.job_start, t1.job_end, t2.[name] AS "conflicting job",
t2.job_start, t2.job_end
FROM
( SELECT [name], job_start, job_end FROM #jobsched
WHERE [name] = 'Job to analyze for conflicts'
) t1
RIGHT JOIN
(
SELECT [name], job_start, job_end FROM #jobsched
WHERE [name] <> 'Job to analyze for conflicts'
) t2
ON (t2.job_start BETWEEN t1.job_start AND t1.job_end
OR t2.job_end BETWEEN t1.job_start AND t1.job_end)
to get a listing of jobs that are conflicting with the job named 'Job to
analyze for conflicts' .
It's also possible that the additional time for the DTS task to process is
due to locking. You could try adding another stop to the DTS job that dumbs
the output of sp_who2 into a table for further analyses.
Hope that the above helps.
--
"Patrice" wrote:

> Hi,
> I have a DTS package that runs 4 other packages on a nightly basis. This
> package usually takes about 2 hours to run, but ocasionally it jumps to
> around 5 hours to complete. There have not been any changes to the
> parameters or coding. It is the same process that causes this each time
> which is a cursor run strored procedure. There have not been any huge jum
ps
> in the number of records in the table or changes to the source data that
> would cause the cursor to take longer to run through. This seems to be
> intermittent, I can not easily check to see if something else in the netwo
rk
> on that server is happening since it is a customer site. Would you think
> that something outside of the package is affecting this since it only happ
ens
> once in a while (about once a w or so), like I mentioned - backups, ser
ver
> processes, other jobs etc.? I just don't know where to look if I have not
> changed anything within my package.
> Thanks,
> Patrice|||Sorry, that last query should have been
SELECT t1.[name], t1.job_start, t1.job_end, t2.[name] AS "conflicting job",
t2.job_start, t2.job_end
FROM
( SELECT [name], job_start, job_end FROM #jobsched
WHERE [name] = 'Job to analyze for conflicts'
) t1
INNER JOIN --INNER replaced RIGHT for the JOIN
(
SELECT [name], job_start, job_end FROM #jobsched
WHERE [name] <> 'Job to analyze for conflicts'
) t2
ON (t2.job_start BETWEEN t1.job_start AND t1.job_end
OR t2.job_end BETWEEN t1.job_start AND t1.job_end)
"Mark Williams" wrote:
> The are many reasons why performance can change over time. One is job
> contention, where multiple jobs are running at the same time. The followin
g
> will dump a listing of jobs, when they started and ended out of the
> msdb.dbo.sysjobhistory system table, and store it in a temporary table:
>
> select t2.[name], t2.job_start, DATEADD(ss,DATEDIFF(ss,'1980-01-01',
> '1980-01-01 ' + t2.job_duration),t2.job_start) AS job_end
> INTO #jobsched
> FROM (
> select t1.[name],
> CAST(
> start_date + ' ' + LEFT(t1.start_time,2) + ':' +
> SUBSTRING(t1.start_time,3,2) + ':' + RIGHT(t1.start_time,2) AS datetime
> ) AS "job_start",
> LEFT(t1.job_duration,2) + ':' + SUBSTRING(t1.job_duration,3,2) + ':' +
> RIGHT(t1.job_duration,2) AS job_duration
> FROM
> (
> select
> j.[name],
> LEFT(CAST(h.run_date AS char(8)), 4) + '-' + SUBSTRING(CAST(h.run_date AS
> char(8)),5,2) + '-' + RIGHT(CAST(h.run_date AS char(8)), 2) AS "start_date
",
> REPLICATE('0', 6 - LEN(h.run_time)) + CAST(h.run_time AS varchar(6)) AS
> "start_time",
> REPLICATE('0', 6 - LEN(h.run_duration)) + CAST(h.run_duration AS varchar(6
))
> "job_duration"
> from msdb.dbo.sysjobhistory h INNER JOIN msdb.dbo.sysjobschedules j
> ON h.job_id = j.job_id
> WHERE h.step_id = 0
> ) t1
> ) t2
> SELECT * FROM #jobsched
> You could take a look at the output of the above and "eyeball" it for job
> conflicts, or you could try (*untested*)
> SELECT t1.[name], t1.job_start, t1.job_end, t2.[name] AS "conflicting job",
> t2.job_start, t2.job_end
> FROM
> ( SELECT [name], job_start, job_end FROM #jobsched
> WHERE [name] = 'Job to analyze for conflicts'
> ) t1
> RIGHT JOIN
> (
> SELECT [name], job_start, job_end FROM #jobsched
> WHERE [name] <> 'Job to analyze for conflicts'
> ) t2
> ON (t2.job_start BETWEEN t1.job_start AND t1.job_end
> OR t2.job_end BETWEEN t1.job_start AND t1.job_end)
> to get a listing of jobs that are conflicting with the job named 'Job to
> analyze for conflicts' .
> It's also possible that the additional time for the DTS task to process is
> due to locking. You could try adding another stop to the DTS job that dumb
s
> the output of sp_who2 into a table for further analyses.
> Hope that the above helps.
> --
> "Patrice" wrote:
>

DTS change file name

Hello all,
I have MS SQL 97.
Can i import from DTS a file every time with another name say COUNTER_MM_DD_YY_HH_MM_SS and not fix file name?
if not can i do it directly from stored procedure?
thank you
InonRefer to SQLDTS (http://www.sqldts.com) website and search for dynamic properties which returns the basic example for your task.sql

Monday, March 19, 2012

DTS Assistance required - Very Long!

Hello all,

Sorry for the length of the post but I want to be thorough and not waste anyones time suggesting something I've already tried. I have an application that pulls data from an oracle (8i) db into SQL Server for processing. At the moment it copies all of the data from the oracle tables into the SQL Tables, I would like to change it so that some of the tables only pull the data that has changes since the DTS package last ran. The first problem I encountered is that the Oracle OLE DB driver doesn't support Dynamic Parameters so I can't use

Select * from Table where Amended_On >= ? and Amended On <= Sysdate -1

(Well not that I would abuse the use of * in a Select query anyway Smile )

Doing a search on Google revealed why I couldn't do it, and looking at www.sqldts.com revealed a possible work around was to add an ActiveX Scripting task to dynamically change the SQL of the Data Pump step along these lines

Option Explicit

Function Main()
Dim oPkg, oDataPump, sSQLStatement

' Get reference to the DataPump Task'
Set oPkg = DTSGlobalVariables.Parent
Set oDataPump = oPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask

' Assign SQL Statement to Source of DataPump

sSQLStatement = oDatapump.SourceSQLStatement
' Build new SQL Statement

sSQLStatement = sSQLStatement & " AND TRUNC(AMENDED_ON) >= '" & _
Day( DTSGlobalVariables("LastRunDate").Value ) & "-" & _
UCASE(MonthName(Month( DTSGlobalVariables("LastRunDate").Value),True )) & "-" & _
Year( DTSGlobalVariables("LastRunDate").Value ) & "'"

' Assign SQL Statement to Source of DataPump
oDataPump.SourceSQLStatement = sSQLStatement

' Clean Up
Set oDataPump = Nothing
Set oPkg = Nothing

Main = DTSTaskExecResult_Success

End Function

Which when I run the ActiveX step and then look at the Source of the Datapump the Clause has been added. Trouble is when I run the package I still retrieve 140000+ rows when I should actually only get one!

The other thing I've tried is to add an ActiveX Transform task to only copy the data if it falls between the date ranges and ordering the results by date descending. This works, but, due to the supplier letting the children into the coding room ,there isn't an index on the field I'm sorting on and the order by clause takes 5 Minutes(!!) which is longer than it takes to import the entire table, so no point there really.

I like the idea of Dynamically adding the parameter to the SQL but can't see what I'm doing wrong to get all the rows returned. If I copy the modified SQL and past it into PL/SQL developer, I get the right result.

Again I apologise for the length

Regards

TonyHi Tony,

This is a forum for the next version of DTS, called Integration Services, so you probably won't get enough qualified eye balls looking at your question to answer it.
Try the microsoft.public.sqlserver.dts newsgroup instead, that should have more activity on it.

thanks,
ash

DTS Append Records

I created and saved a DTS package that appends the records from an access
table into a SQL table. Each time I run the DTS package, SQL appends all
records from the access table, leaving duplicate records.
How can I change a DTS package to just import/append only new records from
the access table?I think there are two options here:
1) use 'query' to get your data out rather than using 'copy table'
option. a primary column is handy in this case, e.g. make the access
database as a linked server, then use a join in the query to only get
new records.
2) rebuild the table each time (delete all the records and get the all
data).
Mel|||Can you give me just a sample of code that selects data from a linked server
and inserts it into a sql table?
"MSLam" <MelodySLam@.googlemail.com> wrote in message
news:1145132520.664664.176650@.e56g2000cwe.googlegroups.com...
>I think there are two options here:
> 1) use 'query' to get your data out rather than using 'copy table'
> option. a primary column is handy in this case, e.g. make the access
> database as a linked server, then use a join in the query to only get
> new records.
> 2) rebuild the table each time (delete all the records and get the all
> data).
> Mel
>|||Other options would be to use the ActiveX options in the Transform step
of th data pump. You could compare Primary keys of the rows to be
inserted to the pre-existing rows, and then simply skip that row.
There are a couple of good books on DTS; I recommend Professional SQL
Server 2000 DTS (Amazon link here:
http://www.amazon.com/gp/product/B0...5Fencoding=UTF8
)
HTH,
Stu|||thanks
"Stu" <stuart.ainsworth@.gmail.com> wrote in message
news:1145149418.433259.318180@.g10g2000cwb.googlegroups.com...
> Other options would be to use the ActiveX options in the Transform step
> of th data pump. You could compare Primary keys of the rows to be
> inserted to the pre-existing rows, and then simply skip that row.
> There are a couple of good books on DTS; I recommend Professional SQL
> Server 2000 DTS (Amazon link here:
> http://www.amazon.com/gp/product/B0...5Fencoding=UTF8
> )
> HTH,
> Stu
>|||As requested,
select id, column2, column3
from AccessTable
where id not in
(select id from SQLTable)
id = primary key
The above query will only select (then insert) records that are not yet
in the SQL Table.
Mel|||how can your code insert data without the "INSERT INTO" syntax?
"MSLam" <MelodySLam@.googlemail.com> wrote in message
news:1145218127.199907.322650@.t31g2000cwb.googlegroups.com...
> As requested,
> select id, column2, column3
> from AccessTable
> where id not in
> (select id from SQLTable)
> id = primary key
> The above query will only select (then insert) records that are not yet
> in the SQL Table.
> Mel
>|||http://www.codeproject.com/useritems/DTS__VBNET_.asp

DTS and Fixed Widths

Hi all.

I'm trying to export some tables in fixed width format for a client that needs it this way. The first time I did this, using Import/Export in Enterprise Manager, integer fields were 12 chars long. However, when I saved this as a DTS and ran it again later, it made integers 4 chars in the text file (which matches the lengths of the datatypes you see in enterprise manager.)

Why is this difference there? What do I need to do differently? Also, is there a list of how wide each data type is when exported as fixed delimited text?

thanks,
CraigWell, I just followed the same steps and received consistent results. My integer files were 12 characters with the initial run, and also when I saved it as a DTS package and ran it.

My suggestion is to check the Transform Data Task Properties in the DTS package and check the information in the Size column on the Destination tab for each column.

When you create the package via the Import/Export option in Enterprise Manager, one of the steps includes a "Transform..." button. Click on this so you can explictly set the size of each column you are exporting.

Terri|||yes I found it. There is a "Define Columns" button that specifies the size. Weird that the same DTS package yielded multiple results.

Thanks!

DTS and Fixed Widths

Hi all.

I'm trying to export some tables in fixed width format for a client that needs it this way. The first time I did this, using Import/Export in Enterprise Manager, integer fields were 12 chars long. However, when I saved this as a DTS and ran it again later, it made integers 4 chars in the text file (which matches the lengths of the datatypes you see in enterprise manager.)

Why is this difference there? What do I need to do differently? Also, is there a list of how wide each data type is when exported as fixed delimited text?

thanks,
CraigWhy don't you use bcp in a sproc with format files?

And as far as DTS changing widths...I don't think (damn it, happened again) so...|||I assume you're talking about Bulk Copy? I haven't done that before, but its definitely an option -- I just ASSUMED DTS would be easier.

Wednesday, March 7, 2012

DTS - Looping in a Data DrivenQuery

Hi Guys

I am reading a table one record at a time. Within this record a field can contain multiple values.
The delimiter is a ^. The data comes from a Pick legacy system
The data looks like this :-
chargeable_item_cd quantity text_1
I77C1^I77C2 1^1 PLATES /SCREWS^1.3MM SET

I want to extract the multiple values from this field and insert a record for each set of values.
I can unravel the data easy enough. The problem I have is how to loop within a DTS Activex
Script to store each of the values extracted from the field before moving onto the next record.
Is it possible or am I better of using a SQL task an taking a fraction of the time. (I am resisting
this as my boss doesnt like SQL code)
I am doing this within a data driven query.

Thanks in advance.

Cheers
Chris

The code I have so far looks like this(but doesnt work). It gives a "No query specification returnedby transform status".
'************************************************* **********
' Visual Basic Transformation Script
'************************************************* **********

' Copy each source column to the destination column
Function Main()
DTSDestination("DHB_Key") = DTSLookups("DHB Lookup").Execute(DTSGlobalVariables("DHB_Code").Value)
DTSDestination("Health_Encounter_Theatre_Key") = DTSSource("rule_violtd_cd")

DTSDestination("Patient_Key") = DTSLookups("Patient Lookup").Execute(left(DTSSource("admit_id"), 7))

DTSDestination("Patient_Care_Episode_Key") = _
DTSLookups("Patient Care Lookup").Execute( DTSDestination("Patient_Key"), _
"*T" + DTSSource("hosp_cd") + DTSSource("scout_sheet_nbr"), _
DTSDestination("DHB_Key"))

DTSDestination("Health_Encounter_Key") = DTSLookups("Hlth Encntr Lookup").Execute( DTSDestination("DHB_Key"), _
DTSDestination("Patient_Key"), _
DTSDestination("Patient_Care_Episode_Key"), _
"TH")
' This piece of code does it for multi field values for charagble items to individual values that can be stored in the database

' Copy each source column to the destination column
DIM string1, string2, string3, sitem, sqty, sdescript, quantity, descript
string1 = DTSSource("chargeable_item_cd")
string2 = DTSSource("quantity")

Do While InStr( string1 , "^") > 0
sitem = left(string1, InStr( string1 , "^") -1 )
sqty = left(string2, InStr( string2 , "^") -1 )
sdescript = left(string3, InStr( string3 , "^") -1 )

DTSDestination("Chargeable_Items_Key") = DTSLookups("Chargeable Items Lookup").Execute(sitem)
DTSDestination("Quantity") = sqty
DTSDestination("Description_Of_Item") = sdescript

If IsNull(sqty) Then
quantity = 0
Else
quantity = sqty
End If

If IsNull(sdescript) Then
descript = "X"
Else
descript = sdescript
End If

If NOT IsNull(DTSDestination("Chargeable_Items_Key")) Then
If DTSLookups("Item Exists Lookup").Execute(DTSDestination("DHB_Key"),_
DTSDestination("Health_Encounter_Theatre_Key"),_
DTSDestination("Patient_Key"),_
DTSDestination("Patient_Care_Episode_Key"),_
DTSDestination("Health_Encounter_Key"),_
DTSDestination("Chargeable_Items_Key"),_
quantity,_
descript) = 0 Then
Main = DTSTransformstat_InsertQuery
Else
Main = DTSTransformStat_SkipRow
End If
Main = DTSTransformStat_OK
End If

string1 = Mid( string1 , InStr( string1 , "^") + 1, Len( string1 ) )
string2 = Mid( string2 , InStr( string2 , "^") + 1, Len( string2 ) )
string3 = Mid( string3 , InStr( string3 , "^") + 1, Len( string3 ) )
loop

Main = DTSTransformStat_OK
End Functionokie, this is what I would do...
write 2 sub routines......

Sub InsertItems(strItems)
Dim arrItems, iItem
arrItems = split(strItems,"^")
for iItem = 0 to uBound(arrItems)
ExecuteSQL("insert into itemTable (column) values (" & arrItems(iItem) & ")"
next
End Sub

Sub ExecuteSQL(strSQL)
On Error Resume Next
Dim oConn, oRs, strConn
Set oConn = CreateObject("ADODB.Connection")
Set oRs = CreateObject("ADODB.Recordset")

strConn = "Your connection string goes here"
oConn.ConnectionString = strConn
oConn.ConnectionTimeout = 30
oConn.Open
oConn.execute(stqSQL
set oConn = nothing
On Error Goto 0
End Sub

in your main function call InsertItems and pass it the value of chargeable_item_cd (assuming I got the name right)

Make sense??|||Hi Rokslide

I take it that this will work inside the Activex Script Transformation Properties portion of a data driven query.

It is nearly knock off time Friday afternoon in NZ so I will try it on Monday morning
.
Cheers
Chris|||Hi Chris,

Your Activex Script can have as many extra functions or sub routines as you like with no problems providing there is only 1 main function.

Nearly knowing off time?? It's only 2pm! ;) It is Friday though and the lead in to a long weekend so... ;)

Where are you working in Christchurch? I used to live and work there myself. :)|||Hi

I am based at Princess Margret Hospital by under the Port Hills but
I live way out in the country about 10 kms the other side of Rangiora
on a 52 acre farmlet.

Cheers|||Cool. :) I used to work for the Council there and then started a company with a friend. Before living in Christchurch I was living out in Cheviot.

Mmmmm country air... ;)

Let me know if you need any more help with that DTS package.

DTS - How to make ActiveX script open a connection in the diagram?

I have a simple question but I'm having a really hard time finding an answer.

Let's say I'm designing a DTS package, and I have a connection to a SQL Server called ConnSQL. How do I reference this connection in my ActiveX script? (so I can run SQL queries and such)

ThanksThere is no way to reference such connections. This is because you can only reference COM objects from VBScript, and the DTS package is not a COM object, but itself a script. Scripting is included to allow you to access objects in the operating system environment.

If you want to run SQL queries against a DTS connection, you want to use a SQL Query task, which operates against whatevery connection you attach it to.

If your goal is moving data between files and/or tables, you want to use a transformation task between two DTS connections (select the source, holding SHIFT, select the second, then click the Transformation Task button on the toolbar.

DTS - help

Create a table (each time different table) we have a DTS to do that
-- 1
There is a fixed delimited text file; we need to Import this file into
the created table above and we have another DTS to do that. 2

We want to combine these two DTS into one.

The problem is when the table does not exist it will not show in the
drop down list for DTS 2.

Is there a way we can pass the table name as a variable name from DTS
1 to DTS 2. Only for 2, we need a DTS. For 1, it can be a stored
procedure or anything.

My main question is if there is a way to pass the variable name (table
name) to DTS2?

Thank you very much for your help in advance.You can assign the table name to a DTS global variable and then use a
dynamic properties task to set DTS object properties to the global variable
value.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Geetha" <gelangov@.hotmail.com> wrote in message
news:4b40e20a.0410280621.cfce123@.posting.google.co m...
> Create a table (each time different table) - we have a DTS to do that
> -- 1
> There is a fixed delimited text file; we need to Import this file into
> the created table above and we have another DTS to do that. -2
> We want to combine these two DTS into one.
> The problem is when the table does not exist it will not show in the
> drop down list for DTS 2.
> Is there a way we can pass the table name as a variable name from DTS
> 1 to DTS 2. Only for 2, we need a DTS. For 1, it can be a stored
> procedure or anything.
> My main question is if there is a way to pass the variable name (table
> name) to DTS2?
> Thank you very much for your help in advance.