Solved

Data Type mismatch in Transformation

Posted on 2003-12-09
3
636 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

821 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