Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Thursday, March 29, 2012

DTS run from .NET

My dts package has to pick up a file which is in a mapped drive of the
sql server... (system1)...
when I run it from code the execution ends up in an error... but if I
have the drive mapped (drive where I have the source file) onto the
web server (system2) the execution goes through fine.. I donot want to
have the drive mapped onto the web server.. how can I do this..Try and use the UNC path.

Joel Scavone|||I did use a full netwok path and even did add identity impersonate in
the web.config... but does not help..

The package runs fine when I register the sql server my machine and run
the package..

Sigh! Don't know what wrong

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Sunday, March 25, 2012

DTS problem: ActiveX Script Task Properties dialog box

My ActiveX Script Task Properties dialog box has the "functions" window
maximized and I
can no longer get at my code.
I can not find any way to resize it.
Please ...
If anyone has come across this and can help...
it will be much appreciated.
I've never had this happen before.
Thanks in advance,
bob mcclellanDid you find out the fix for that dialog box problem?|||I went to C:\Program Files\Microsoft SQL Server\80\Tools\Binn directory
and Registered ALL dll's
*** Sent via Developersdex http://www.examnotes.net ***

DTS Problem

I'm having a bit of a problem getting a date parsed from a text file, if anyone has some time please take a look at this DTS code and let me know if you have any ideas. Thanks in advance!

'************************************************* *********************
' Visual Basic Transformation Script
' Copy each source column to the
' destination column
'************************************************* ***********************
Function Main()
DTSDestination("TableName") = DTSSource("Col001")
DTSDestination("Code") = DTSSource("Col002")
DTSDestination("Status") = DTSSource("Col003")
DTSDestination("ISN") = DTSSource("Col004")
DTSDestination("Description") = DTSSource("Col005")
DTSDestination("LongDescription") = DTSSource("Col006")
DTSDestination("OwnerSystem") = DTSSource("Col007")
DTSDestination("CodeFieldAttribute") = DTSSource("Col008")
DTSDestination("CodeFieldLength") = DTSSource("Col009")
DTSDestination("CodeEditRules") = DTSSource("Col010")
DTSDestination("EffectiveDateMaint") = DTSSource("Col011")
DTSDestination("StartDate") = getdate(DTSSource("Col012"))
'DTSDestination("StartDateInv") = getdate(DTSSource("Col013"))
DTSDestination("EndDate") = getdate(DTSSource("Col014"))
' DTSDestination("EndDateInv") = getdate(DTSSource("Col015"))
DTSDestination("Hold") = DTSSource("Col016")
Main = DTSTransformStat_OK
End Function

Function getDate(aDate)
Dim year, month, day

If Trim(aDate) = "" Or IsNumeric(aDate) Then
getDate = Null
Exit Function
End If

year = Mid(aDate, 1, 4)
month = Mid(aDate, 5, 2)
day = Mid(aDate, 7, 2)

getDate = DateSerial(year, month, day)

End FunctionLooking at your code leads to a few questions:

What is the error that you are getting? What is the value within DTSSource("Col012") and DTSSource("Col014")? Are the date fields all coming back NULL?

If so, then is the original column data in the format 20060725?

Also, the DateSerial function takes in numeric parameters, not strings, so you might need to convert the year, month, and day.

Finally, the section:

If Trim(aDate) = "" Or IsNumeric(aDate) Then
getDate = Null
Exit Function
End If

would work better as

If IsNumeric(aDate) Then
getDate = Null
Exit Function
Elseif Trim(aDate) = "" Then
getDate = Null
Exit Function
End If

Since Trim on a Numeric will cause an error, so it is good to test the trim after confirming it is not numeric.|||a simple rearrangemet of text date data will do the trick. try the code below (this assumes your text data is in the form of yyyymmdd otherwise you need to change the code a bit)

DTSDestination("StartDate") = left(DTSSource("Col012"),4) & "-" & mid(DTSSource("Col012"),5,2) & "-" & right(DTSSource("Col012"),2)|||Thanks guys, both your posts were very helpful. The problem actually was in the text file that I was trying to import, someone had entered dates in a yy/mm/dd format rather then yyyy/mm/dd once that was fixed the function performed as it should. Thanks alot!|||A couple of questions:

1.
With the supplied code
"
year = Mid(aDate, 1, 4)
month = Mid(aDate, 5, 2)
day = Mid(aDate, 7, 2)
"
wouldn't the slashes get in the way? I would guess that the code would have to change to:
"
year = Mid(aDate, 1, 4)
month = Mid(aDate, 6, 2)
day = Mid(aDate, 9, 2)
"
to get past whatever /,-, or . that was delimiting the date?

2. How does one Charboil something? I mean, by being in water wouldn't it get overcooked but not charred? :)

DTS prediction

Well thanx a lot because i've got the reply. And now i want to ask about prediction data mining using DTS. Should i make some code to perform in my vb application? and how to join my table case with the tree result?
Thank you so much

There are two way to do prediction in Integration Services (DTS in SQL 2000):

the Data Mining Query Task which allows to run a prediction query against an external data source (or inline data in the case of singleton query) and save the result to a table

Friday, March 9, 2012

dts package active x script

I want to rename my file in the active x script in my DTS package and archive it in a archive folder. My code is archiving the file in the archive, but I need to rename the file too so that it has filename_today's date. I wrote the code like this

set fso = CREATEOBJECT("Scripting.FileSystemObject")

fso.MoveFile DTSGlobalVariables("FileFullName").Value ,DTSGlobalVariables("ArchiveLocation").Value

before this step I want to write

fso.renamefile(DTSGlobalVariables("FileFullName").Value DTSGlobalVariables("FileFullName").Value & now)

and after this step I want to do

fso.MoveFile DTSGlobalVariables("FileFullName").Value ,DTSGlobalVariables("ArchiveLocation").Value

so in the archive folder I can have the date of the file that has been archived.

when i trying to do this

fso.renamefile(DTSGlobalVariables("FileFullName").Value DTSGlobalVariables("FileFullName").Value & now)

I am getting an error
Cannot use parantheses while calling a sub.

Please let me know how can I do this

Off the top of my head, the first thing I would try would be this:
fso.renamefile DTSGlobalVariables("FileFullName").Value DTSGlobalVariables("FileFullName").Value & now
|||I tried this, but now I am getting the error
Object doesn't support this property or method: 'fso.RenameFile'
Please let me know how can I fix this
Any help will be greatly appreciated|||

I figured it out.
Thanks

DTS Package - "Provider generated code execution exception: "EXCEPTION_ACCESS_VIOLATION"

When running a step within my DTS package I'm receiving the following
error - "Provider generated code execution exception:
"EXCEPTION_ACCESS_VIOLATION".
I think it may be something to do with my global variable, but I'm not
sure as I'm pretty certain I've set it all up correctly.
Below are screenprints showing my settings.
http://img153.imageshack.us/my.php?image=19tv1.jpg
http://img153.imageshack.us/my.php?image=25wz1.jpg
http://img153.imageshack.us/my.php?image=39pf.jpg
http://img164.imageshack.us/my.php?image=43nx.jpg
http://img164.imageshack.us/my.php?image=51ao.jpg
http://img164.imageshack.us/my.php?image=64lo.jpg
http://img164.imageshack.us/my.php?image=71yn.jpg
Any advice of fixing this would be greatly appreciated.Can anyone help? The below screenshots show my specific settings (note
I'm still getting the same error with these options)
http://www.files2net.com/files/46053431/1.JPG
http://www.files2net.com/files/266513949/2.JPG
http://www.files2net.com/files/266955779/3.JPG

DTS Package - "Provider generated code execution exception: "EXCEPTION_ACCES

When running a step within my DTS package I'm receiving the following error
- "Provider generated code execution exception: "EXCEPTION_ACCESS_VIOLATION"
.
I think it may be something to do with my global variable, but I'm not sure
as I'm pretty certain I've set it all up correctly.
Below are screenprints showing my settings.
http://img153.imageshack.us/my.php?image=19tv1.jpg
http://img153.imageshack.us/my.php?image=25wz1.jpg
http://img153.imageshack.us/my.php?image=39pf.jpg
http://img164.imageshack.us/my.php?image=43nx.jpg
http://img164.imageshack.us/my.php?image=51ao.jpg
http://img164.imageshack.us/my.php?image=64lo.jpg
http://img164.imageshack.us/my.php?image=71yn.jpg
Any advice of fixing this would be greatly appreciated.Can anyone help? The below screenshots show my specific settings (note I'm s
till getting the same error with these options)
http://www.files2net.com/files/46053431/1.JPG
http://www.files2net.com/files/266513949/2.JPG
http://www.files2net.com/files/266955779/3.JPG|||Managed to solve it by changing the settings to the following:
http://www.files2net.com/files/154842170/settings.jpg

Wednesday, March 7, 2012

DTS Package

Hi:
I am simply trying to use vbscript in a package to sort through and find
records.
I cannot seem to get the regular vbscript code to run properly, it either
doesn't parse properly, or it tells me I am using an incorrect recordset.?
Please help.
Thank you ,
Kyle
Unfortunately that doesn't give us enough information to
help you out. Could you post the VB Script code you are
using?
-Sue
On Mon, 12 Jul 2004 07:49:05 -0400, "Kyle McAdam"
<kyle.mcadam@.sympatico.ca> wrote:

>Hi:
>I am simply trying to use vbscript in a package to sort through and find
>records.
>I cannot seem to get the regular vbscript code to run properly, it either
>doesn't parse properly, or it tells me I am using an incorrect recordset.?
>Please help.
>Thank you ,
>Kyle
>
|||Kyle,
Do please check your system clock.
Dejan Sarka
"Kyle McAdam" <kyle.mcadam@.sympatico.ca> wrote in message
news:4booc.44840$FH5.1018229@.news20.bellglobal.com ...
> Hi:
> I am simply trying to use vbscript in a package to sort through and find
> records.
> I cannot seem to get the regular vbscript code to run properly, it either
> doesn't parse properly, or it tells me I am using an incorrect recordset.?
> Please help.
> Thank you ,
> Kyle
>
|||Can you post the code and the error messages you are receiving?
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Kyle McAdam" <kyle.mcadam@.sympatico.ca> wrote in message
news:4booc.44840$FH5.1018229@.news20.bellglobal.com ...
Hi:
I am simply trying to use vbscript in a package to sort through and find
records.
I cannot seem to get the regular vbscript code to run properly, it either
doesn't parse properly, or it tells me I am using an incorrect recordset.?
Please help.
Thank you ,
Kyle