dbTalk Databases Forums  

VB Script in DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss VB Script in DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Patrick Wang
 
Posts: n/a

Default VB Script in DTS - 09-02-2003 , 08:06 PM






I am importing data from an Access DB to SQL Server 2000.

However, besides those field in the Access DB, I would
like to add a field named GST.

I add the following statments in my Transformation Section
in SQL Server but it doesn't work. Is there any
suggestion ? Thanks

If DTSSource("Country") = "Canada" Then
DTSDestination ("GST") = 0.15
Else
DTSDestination ("GST") = 0
End If



Reply With Quote
  #2  
Old   
soma
 
Posts: n/a

Default VB Script in DTS - 09-03-2003 , 01:20 AM






in char comparison its safe to use trim.
If ltrim(rtrim(DTSSource("Country"))) = "Canada" Then
DTSDestination ("GST") = 0.15
Else
DTSDestination ("GST") = 0
End If

Quote:
-----Original Message-----
I am importing data from an Access DB to SQL Server 2000.

However, besides those field in the Access DB, I would
like to add a field named GST.

I add the following statments in my Transformation
Section
in SQL Server but it doesn't work. Is there any
suggestion ? Thanks

If DTSSource("Country") = "Canada" Then
DTSDestination ("GST") = 0.15
Else
DTSDestination ("GST") = 0
End If


.


Reply With Quote
  #3  
Old   
Patrick Wang
 
Posts: n/a

Default VB Script in DTS - 09-03-2003 , 01:47 AM



I find that when I go to the package, edit the connection
between Access and SQL Server as follow and it works:
1) I create the field "GST" in Destination Tab (It creates
the column "GST in the "Available Columns" in
the "Transformation" tab
2) I add "GST" in the "Selected Column" of "Destination
Columns" in the "Transformation" tab

However, I find that when I execute the same package
again. Another 40 rows (The Access DB consists of 40
records) are added to the table. How can I include a step
of "truncating the table in SQL Server table process
before importing data" in the package?

Thanks


Quote:
-----Original Message-----
in char comparison its safe to use trim.
If ltrim(rtrim(DTSSource("Country"))) = "Canada" Then
DTSDestination ("GST") = 0.15
Else
DTSDestination ("GST") = 0
End If

-----Original Message-----
I am importing data from an Access DB to SQL Server 2000.

However, besides those field in the Access DB, I would
like to add a field named GST.

I add the following statments in my Transformation
Section
in SQL Server but it doesn't work. Is there any
suggestion ? Thanks

If DTSSource("Country") = "Canada" Then
DTSDestination ("GST") = 0.15
Else
DTSDestination ("GST") = 0
End If


.

.


Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: VB Script in DTS - 09-03-2003 , 02:58 AM



Before the datapump task you add an ExecuteSQL tasks and use the correct
connection as the connection for it. You can then issue a DELETE or
TRUNCATE in there. You join that onto your DataPump task using workflow.

Introduction to Workflow
(http://www.sqldts.com/default.aspx?287)

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Patrick Wang" <patrickwang (AT) hknetmail (DOT) com> wrote

Quote:
I find that when I go to the package, edit the connection
between Access and SQL Server as follow and it works:
1) I create the field "GST" in Destination Tab (It creates
the column "GST in the "Available Columns" in
the "Transformation" tab
2) I add "GST" in the "Selected Column" of "Destination
Columns" in the "Transformation" tab

However, I find that when I execute the same package
again. Another 40 rows (The Access DB consists of 40
records) are added to the table. How can I include a step
of "truncating the table in SQL Server table process
before importing data" in the package?

Thanks


-----Original Message-----
in char comparison its safe to use trim.
If ltrim(rtrim(DTSSource("Country"))) = "Canada" Then
DTSDestination ("GST") = 0.15
Else
DTSDestination ("GST") = 0
End If

-----Original Message-----
I am importing data from an Access DB to SQL Server 2000.

However, besides those field in the Access DB, I would
like to add a field named GST.

I add the following statments in my Transformation
Section
in SQL Server but it doesn't work. Is there any
suggestion ? Thanks

If DTSSource("Country") = "Canada" Then
DTSDestination ("GST") = 0.15
Else
DTSDestination ("GST") = 0
End If


.

.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.