Solved

Data Type mismatch in Transformation

Posted on 2003-12-09
3
638 Views
Last Modified: 2007-12-19
Hey Folks,

I rather new at DTS packages, so here goes...

I have an XL spreadsheet that I am trying to load into MSSQL2000.

most of the transformations are straight column copy.

I have one transformation that does a lookup, named 'CycleNo'.  here is my SQL for the lookup

SELECT     Cycle
FROM         CC_EachCycleInfo
WHERE     (SAPCustNo = ?)
ORDER BY Cycle DESC

here is vbscript for the transform

Function Main()
  DTSDestination("CycleNo") =     DTSLookups("CycleNo").Execute( DTSSource("SAPCustNo"))
  Main = DTSTransformStat_OK
End Function

when I test the transformation I get a 'data type mismatch in criteria expression' error

data type for DTSSource("SAPCustNo") is Long (this is from the tooltip you get when hovering over the fieldname of the transformations tab in the transform data task properties window.)

data type for  DTSDestination("CycleNo") is BIGINT

if I hardcode DTSSource("SAPCustNo") like ...

DTSDestination("CycleNo") =     DTSLookups("CycleNo").Execute(10266)

then it works


I have another transformation that is displaying the same symptoms, but If I can get this working then I can probably get the other one working.

'====================================================================
PART II

on another note.  I am also using a few global variables, but when I specify the data types in the 'global variables' tab of the Edit DTS Package dialog my changes dont seem to get saved.  i.e. I have a GlobVar named SAPCustNo that is set to 'STRING'  when I change it to 'INTEGER', Save/Exit and Edit the package again, the data types for all my GlobVars are set to string again.  ARGHH!!

does anyone have any ideas on this?
0
Comment
Question by:DialM4Monkey
3 Comments
 
LVL 34

Accepted Solution

by:
arbert earned 300 total points
ID: 9908430
long and bigint are different datatypes.  wrap your DTSDestination("CycleNo") with a clng function:


Function Main()
  DTSDestination("CycleNo") =     DTSLookups("CycleNo").Execute(clng( DTSSource("SAPCustNo")))
  Main = DTSTransformStat_OK
End Function


On your Global variable problem, right click anywhere on "white space" inside your package and choose "disconnected edit".  Search the dts properties for your global data types and change them there--you might have more luck.
Brett
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Stored Proc - Rewrite 42 62
SQL Server / Update DB? 22 38
Isolation level setting TSQL View 10 30
MS SQL + group by time 4 15
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question