AS 400 Data Being Interpreted As Unicode Strings (DT_WSTR) Datatype
Jun 23, 2006
I am building a data warehouse. Some of the data comes from an AS 400 EPR system. I used the OLEDB connector when first pulling the data into SQL Server doing simple import data from table option. That worked great for getting the initial data load into SQL Server and creating the base SQL Server tables although it was excruciatingly slow (that was probably due to the transport from the AS 400).
Now, I need to get new records that are added to the AS400 side of things on a daily basis. For that, I was trying to use the OLEDB AS400 connector. However, I found that the OLEDB connector wouldn't work when I was trying to specify an SQL Statement for what to get; i.e., a simple query like Select * from TWLDAT.STKT where BYSDAT >= '2005-01-27' would simply not work. Found articles here explaining that it is probably a problem on the AS400 side of things and where people recommended using an ADO ODBC data reader source for this type of thing. So, I'm trying to implement that. However, I have a huge problem with it.
The original tables that got created were mapped to use NVARCHAR fields for character data. When the ADO ODBC data reader source accesses the AS400 data, it insists on interpreting the string type fields as being unicode strings and giving it a data type of DT_WSTR when what I need it to have is a plain old DT_STR data type. When the strings are interpreted as unicode strings, they cannot be converted in a way that allows the NVARCHAR fields to be filled with the data. The exact error message I get for all the fields that should wind up being nvarchar fields is as follows:
Column "BYStOK" cannot convert between unicode and non-unicode string data types.
Okay, so I try to change the data types in the ADO ODBC data reader to be plain DT_STR data types and I cannot do so.
Does anyone have any idea why the ADO ODBC data reader source insists on interpreting the string data coming from the AS 400 as unicode string data or why it refuses to allow that to be changed to DT_STR data type?
Thanks in advance for any info. By the way, if there is a better way than the ADO ODBC data source to get at this data when I need to specify an SQL command, I would love to hear about it. Not wild about using ODBC in the OLEDB age.
Steve Wells
View 9 Replies
ADVERTISEMENT
Nov 23, 2006
Since my foxpro OLE driver has been rendered useless by service pack 1 for sql server 2005 I am forced to use the .net data provider for odbc.
I am importing a number of tables.. each time I add the DataReader Source to the dataflow and connected it to the OLE DB Destination I get a load of the good old "cannot convert between unicode and non-unicode string data types" errors...
So I'm having to do derived column transforms, for each and every column that it coughs up on.
Using expressions like (DT_STR,30,1252)receivedby to convert the "recievedby" column to a DT_STR,
Some of these tables have 100 string columns.. so I'm getting a bit sick of the drudgery of adding all these derivations...
Is there any way to tell this provider to stop deciding that the strings in the foxpro tables are unicode?
Thanks
PJ
View 3 Replies
View Related
Mar 20, 2008
SELECT * from tableeMass where Name=N'???'
In the above select statement in microsoft SQL server 2005 ,I only want to select all the rows whose name is '???' a Gee'z string(Gee'z is set of Ethiopian characters) it is a unicode string(???=gebru in english,the reason why it is question mark is the characters are gee'z).When we execute the select statement, it brings all the rows instead of the rows whose name is '???'.
why? the data type of column Name is nvarchar(50).would you please
help me in tackling the problem.
please reply me soon,I really need it badly soon for my project of Localized database development.
thanks inadvance.
gebru
View 5 Replies
View Related
Jul 13, 2004
I could not write Unicode strings into SQL Server 2000 databse, for example "ÁU", "Tu?n"...
by using oleDbAdapter with InserCommand.
Please give me an instruction.
Thanks so much!
TaiPH - VietNam
View 1 Replies
View Related
Jul 14, 2004
I could not insert Unicode strings into SQL Server 2000 DB by using OleDbAdapter (insert into command), e.g: "á à u".
Please give me an instruction.
Thank you.
View 3 Replies
View Related
Jul 20, 2005
Here is the situation, please let me know if you have any tips:..TXT files in a share at \fooSPROCS run daily parses of many things, including data on that share. Theother day, we encountered rows in the TXT files which looked like:column1Row1data,column2Row1datacolumn1Row2data,column2Row2data...etc..However, column2 was about 6000 bytes of unicode. We are bulk insertinginto a table specifying nvarchar(4000). When it encounters high unicoderows, it throws a truncation error (16).We really need information contained in the first 200 bytes of the string incolumn2. However, the errors are causing the calling SPROC to abort.Please let me know if you have any suggestions on workarounds for thissituation. Ideally, we would only Bulk Insert a sub-section of column2 ifpossible.Thanks!/Ty
View 2 Replies
View Related
Mar 8, 2007
We've installed the Oracle provider for OLE DB on SQL Server 2005, which has the default collation (SQL_Latin1_General_CP1_CI_AS), and we've created a linked server for the Oracle 9.2.0.5 database, which has AL32UTF8 as the database character set. We can successfully insert strings into VARCHAR2 columns on Oracle from SQL Server via EXEC SP_EXECUTESQL('INSERT OPENQUERY(...) VALUES(...)') -- as long as the strings (whether selected from NVARCHAR columns on SQL Server or specified as literals with the N prefix during testing) only contain Windows-1252 characters.
If the SQL statement contains a character above U+00FF, the string on the Oracle side is incorrectly/doubly encoded; there are nearly (but not exactly) 4 bytes per character instead of the 1 or 2 you'd expect from ASCII/Latin-1 characters encoded as UTF-8.
We've tried reconfiguring the linked server: collation compatible = false, use remote collation = true, and collation name = Latin1_General_BIN2. But that had no effect.
What is the correct way to do this?
Thanks!
View 1 Replies
View Related
Aug 7, 2012
I am following the SSIS overview video- URL...I have a flat file that i want to import the contents onto a SQL database.I created a Dataflow task, source file and oledb destination.I am getting the folliwung error -"column "A" cannot convert between unicode and non-unicode string data types".in the origin file the data type is coming as string[DT_STR] and in the destination object it is coming as "Unicode string [DT_WSTR]"I used a data conversion object in between, dosent works very well
View 5 Replies
View Related
Jul 28, 2005
Good afternoon
View 32 Replies
View Related
Sep 9, 2015
I have an SSIS package that pulls data from a MYSQL DB (Using RSSBus for Salesforce in SSIS to accomplish this). Most of the columns are loading properly, but I have many columns that I need to convert.
I have been using the Data Conversion dataflow task in SSIS to convert the rows.
I have 2 data conversions that work on most of the columns, but the DESCRIPTION column continues to return an error saying "Cannot convert between unicode and non-unicode types", regardless of what I choose on the Data Conversion task. So, basically I want to dump this column data into a SQL table with NVARCHAR datatypes. Here is what I am doing in my SSIS package...
1) Grab subset of data from SOURCE
2) Converts to TEXTSTREAM. (Data Conversion)
3) Converts to STRING. (Data Conversion)
4) Load Destination table. (OLE DB Destination)
I have also tried to simply convert the values to STRING, but that doesn't work either.
So, I have 2 Data Conversions working here that process most of the data correctly. What I can do to load the DESCRIPTION column?
View 8 Replies
View Related
May 14, 2008
Hi guys and gals,
I've had some great headaches with SSIS this morning, which I have managed to get a workarounds for, but I'm not happy with them so I've come to ask for advice.
Basically, I am exporting data from an SQL Server database into an Excel spreadsheet and hitting issues with unicode and non-unicode data types.
For example, I have a column that is char(6) and have added a data conversion step to the data flow, which converts it to type DT_WSTR and then everything works!
However, this seems like a completely un-neccessary step as I should be able to do the conversion in T-SQL - but no matter what I try I keep getting the same problem.
SELECT Cast(employee_number As nvarchar(255)) As [employee_number]
FROM employee
WHERE forename = 'george'
ErrorValidation error. details: 1 [1123]: Column "employee_number" cannot convert between unicode and non-unicode string data types.
I know I have a solution (read: workaround) but I really don't want to do this everytime!
Any suggestions for what else to try?
View 8 Replies
View Related
Apr 6, 2006
I have an Excel Source component hooked to an OLE DB Destination component in my SSIS 2005 Data Flow Task. After I mapped the excel columns to the OLE DB table columns i get these errors below. I noticed that for the first error, the Excel Field format (when you mouse over the column name in the mappings section in OLE DB component) is of type [DTWSTR] and the corresponding SQL field from my SQL table that it's mapping to is of type [DT_STR] when mousing over that field in the mappings in the properties of my OLE DB component. All table fields in SQL Server for the table I'm inserting into are of type varchar.
print screens here:
http://www.webfound.net/excel_ssis.jpg
http://www.webfound.net/excel_to_oledb_mappings.jpg
Package Validation Error
------------------------------
ADDITIONAL INFORMATION:
Error at Data Flow Task [OLE DB Destination [27]]: Columns "Commission Agency" and "CommissionAgency" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [27]]: Column "Product" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [27]]: Columns "Officer Code" and "OfficerCode" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [27]]: Columns "Agency Name" and "AgencyName" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [27]]: Columns "Agency Id" and "AgencyID" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [27]]: Columns "Tran Code" and "TranCode" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [27]]: Columns "User Id" and "UserID" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [27]]: Columns "Acct Number" and "AccountNumber" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [DTS.Pipeline]: "component "OLE DB Destination" (27)" failed validation and returned validation status "VS_ISBROKEN".
Error at Data Flow Task [DTS.Pipeline]: One or more component failed validation.
Error at Data Flow Task: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
View 3 Replies
View Related
Jan 15, 2007
HI.
I'm having this problem.
I use Visual Studio's, integration project to load XML file into SQL Server. In the XML file, i have defined collumns as string. When i try to load XML file with parts defined in scheme as string, i get an error "cannot convert between unicode and non-unicode string data type.
Destinated collumns in SQL are defined as varchar and char.
Thanks for help
View 11 Replies
View Related
Mar 7, 2008
Hi,
I have spent countless number of hours trying to solve the issue, but to no vail. My problem is SSIS throws "cannot convert between unicode and non-unicode string data types" when i am try to transform data from DB2 to SQL Server 2005. And please note, i tried all possibilities like changing the destination field which is in SQL Server 2005 to nvarchar and also text. But so far no help. And i also looked at previous posts which did not help me either.
Thank You in advance.
View 8 Replies
View Related
Aug 22, 2007
Hello guys!
I am looking for the best DataType that makes it possible to store strings of variable length (from 15 to 300 caracters, rarely longer).
Thanks a lot for any help !
Regards,
Fabianus
my favorit hoster is ASPnix : www.aspnix.com !
View 3 Replies
View Related
Aug 10, 2007
Hello,
I have a varchar column that inludes dates in the following fomat: 03032007? When I try to cast this to datetime, I keep getting "Arithmetic overflow error converting expression to data type datetime." error. Maybe someone has some ideas how to handle this?
Thanks!
View 4 Replies
View Related
Jul 23, 2005
Hi all, we are now planning to upgrade our application from anon-unicode version to a unicode version. The application's backend isa SQL Server 2000 SP3.The concern is, existing business data are stored using collation"Chinese_PRC_CI_AS", i.e. Simplified Chinese. So I thought we need toextract these data out to the new SQL Server which is using Unicode (Iassume it means converting them to nchar, nvarchar type of fields for Idon't enough information from the application side, or is there ageneral unicode collation that will make even char and varchar types tostore data as Unicode?).The problem is what's the best and most efficient way to do this dataconversion?bcp? DTS? or others?thanks a lot
View 6 Replies
View Related
May 6, 2015
In my package , I am used CDC Source transformation and received the Net changes then insert into Destination. But whatever Data coming from CDC source data type Varchar value needs to Converting Non Unicode string to Unicode string SSIS. So used Data conversion transformation to achieved this.  I need to achieve this without data conversion.
View 3 Replies
View Related
Aug 8, 2006
I'm connecting to a SQL Server 2005 database using the latest (beta) sql server driver (Microsoft SQL Server 2005 JDBC Driver 1.1 CTP June 2006) from within Java (Rational Application Developer).
The table in SQL Server database has collation Latin1_General_CI_AS and one of the columns is a NVARCHAR with collation Indic_General_90_CI_AS. This should be a Unicode only collation. However when storing for instance the following String:
‚¬_£_ÙÚÜÛùúüû_ÅÆØåæøߣÇçÑñ_¼½¾_ЎўЄєÒ?Ò‘_прÑ?туф_ЂЉЊЋ
... it is saved with ? for all unicode characters as follows (when looking in the database):
‚¬_£_ÙÚÜÛùúüû_ÅÆØåæøߣÇçÑñ_¼½¾_??????_??????_????
The above is not correct, since all unicode characters should still be visible. When inserting the same string directly into the sql server database (without using Java) the result is ok.
Also when trying to retrieve the results again it complains about the following error within Java:
Codepage 0 is not supported by the Java environment.
Hopefully somebody has an answer for this problem. When I alter the collation of the NVARCHAR column to be Latin1_General_CI_AS as well, the data can be stored and retrieved however then of course the unicode specific characters are lost and results into ? So in that case the output is as described above (ie ‚¬_£_ÙÚÜÛùúüû_ÅÆØåæøߣÇçÑñ_¼½¾_??????_??????_????)
We would like to be able to persist and retrieve unicode characters in a SQL Server database using the correct JDBC Driver. We achieved this result already with an Oracle UTF8 database. But we need to be compliant with a SQL Server database as well. Please help.
Thanks in advance for your help.
View 7 Replies
View Related
Apr 1, 2008
Hi,
A really basic problem in psuedo code...
select * from mytable where email = 'test@go.com'
This throws back:
Unclosed quotation mark before the character string 'test@'.
Line 1: Incorrect syntax near 'test@'.
Unclosed quotation mark before the character string ''.
Because of the 'go'. Other addresses featuring 'go' suffer the same problem. How do I escape it?
Thanks,
Joe
View 4 Replies
View Related
May 7, 2009
For packages that I have created to read Oracle 10g tables, that work fine with debugging in 32-bit mode, I get an error message on all string fields when I try to run in 64-bit mode. An example error message is:[OLE DB Source [1]] Error: Column "ACCT_UNIT" cannot convert between unicode and non-unicode string data types.Another interesting warning included is:[OLE DB Source [1]] Warning: The external columns for component "OLE DB Source" (1) are out of synchronization with the data source columns. The external column "ACCT_UNIT" needs to be updated.I cannot even try to convert this data with a Data Conversion item because the (red) error is on the OLE DB Source item and stops there. It doesn't matter what the destination is or even if there is a destination in the package yet.I'm using Oracle Provider for OLE DB, Oracle Client version 10.203 for 32-bit and Oracle Client 10.204 for 64-bit.Oracle is 10g on a UNIX 64-bit server and the data is not unicode.I'm using SQL Server Enterprise 2008 (10.0.1600) on Windows Server 2008 Standard SP1 on a 64-bit server.The packages work fine in 32-bit mode and the data is not unicode data. When I change Run64BitRuntime to True in the Debugging Property Page, I get the error on the OLE DB Source item. I also get the error when I schedule a package to run using the SQL Server Agent.
View 4 Replies
View Related
Jun 29, 2006
Any one know the process of transfering the database from non-unicode to unicode. Coz I like to transfer the data from english to hebrew.
View 1 Replies
View Related
Feb 28, 2008
Hi,
In excel file, I have one column CertNum. The Sqlserver destination column is CertNum of type int. I am using one data conversion to convert excel CertNum to integer datatype. I am getting the error like Potentila loss of data, truncation occurs. So Before doing the Data Conversion I included one Derived column with the expression
ISNULL([CertNum) || [CertNum] == "" ? 0 : [CertNum]. Then here I am getting error: The DT_14 and DT_WSTR are incomaptable datatypes.
How to avoid this error?
Thanks in advance
View 11 Replies
View Related
Apr 14, 2008
Hello How can we convert DT_WSTR (Unicode) to DT_STR (Data string)
i cant use DATA CONVERSION transformation
Using SQL and SSIS
Please let me know
Thanks
View 4 Replies
View Related
Oct 16, 2007
OK, the thread's name is not very self explanatory so here I go:
The fact
I'm working on a simple APP where I store the date of a transaction. I use in my Stored Procedure the getdate() as the default (and untouchable) value for the transaction date
The problem:
These transactions are made all day long and there are transctions made on the morning and afternoon. Now, when I make a report of the transactions for one specific range of days, all the transactions made in the morning of the start date are ignored completely.
Say I have these transactions
TCode TType TDate
45 REQ 03/09/2007 08:20:16 a.m.
46 REQ 03/09/2007 11:59:43 a.m.
47 REQ 03/09/2007 12:01:30 p.m.
48 REQ 03/09/2007 06:01:49 p.m.
and I make this query
SELECT * FROM <Table Name> WHERE TDate BETWEEN <Start Date> AND <End Date>
(where <Start Date> && <End Date> are 03/09/2007 selected from a DateTimePicker control)
I only get these results 47 REQ 03/09/2007 12:01:30 p.m.
48 REQ 03/09/2007 06:01:49 p.m.
if I make a cast as integer I get these results:
TCode TDate TCast
46 2007-09-03 11:59:43.000 39326
47 2007-09-03 12:01:30.000 39327
so my question is
Why are the Morning Transactions from the start date ignored (or interpreted as part of previous day transactions) ?
View 1 Replies
View Related
Mar 9, 2005
I am getting unicode data into my database table and I am unable to see that data in my quesry analyzer. Can I convert that unicode data into varchar datatype?
AND how can i See that unicode data.
View 3 Replies
View Related
Feb 20, 2007
Hi.
We have a sql server db that we need to store Unicode text in. The fields are of the type nvarchar, ntext and nchar. Our solution uses both Oracle and SqlServer as a backing database. In Oracle there is a connection string switch "Unicode=True" that fixes the problem. Is there something similar in SqlServer? Since the db layer is generic we'ed like to avoid using a N' prefix on text strings in query statements.
View 2 Replies
View Related
Sep 28, 2007
Hi,
Could someone please tell me how to update data in a column that contains unicode data in SQL 2000?
I know how to write update scripts on my own, but when it comes to Unicode character updates I canÂ?ft manage. In the script that I have pasted below I can update the customerÂ?fs details, but this only works if I update with Romaji characters (non-unicode).
The data that I need to update is in Japanese Kanji, but when I use the 'Update' script below, the data is updated as all question marks (???????????).
Is it very much harder to get the script to where it will handle Unicode characters and insert the correct data?
UPDATE CUSTOMER_LANGUAGE_DETAILS
SET FIRST_NAME = '‰h�s'
WHERE CUSTOMER_ID = 1592
View 1 Replies
View Related
May 22, 2007
I am getting problem in fetching data from SQL using C++ program.
How to Fetch SQL Unicode characters?
I am using ODBC driver calls in C++ to fetch SQL data.
It is working fine with character data.
But for Unicode data it displays €œ????€? instead of data.
I am using SQL Server SQLSRV32.DLL for creating datasource.
Following is my code:
#include <windows.h>
#include <sqlext.h>
#include<srv.h>
#include<stdio.h>
#include <iostream.h>
#include <string.h>
int main(void)
{
void print_err2(RETCODE rc, SQLINTEGER type, SQLHANDLE handle);
HENV hEnv = NULL; // Env Handle from SQLAllocEnv()
HDBC hDBC = NULL; // Connection handle
HSTMT hStmt = NULL;// Statement handle
//UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "myDataSource";// Data Source Name buffer
USHORT *szDSN;
szDSN = (USHORT *) malloc (sizeof(USHORT) * 13);
szDSN= (unsigned short *)"myDataSource";
//UCHAR szUID[10] = "sa";// User ID buffer
USHORT *szUID;
szUID= (unsigned short *) "sa";
//UCHAR szPasswd[10] = "bmcAdm1n";// Password buffer
USHORT *szPasswd;
szPasswd= (unsigned short *) "bmcAdm1n";
char buff[9] = "Testing";
// UCHAR szSqlStr[128]= "INSERT into Quali (Colname) Values ('Testing')" ;
//UCHAR szSqlStr[150]= "select name ,default_database_name,default_language_name from sys.sql_logins" ;
USHORT *szSqlStr;
szSqlStr = (USHORT *) malloc (sizeof(USHORT) * 150);
szSqlStr= (unsigned short *) "select name ,default_database_name,default_language_name from sys.sql_logins" ;
RETCODE retcode;
//UCHAR sqlState; // buffer to store SQLSTATE
// UCHAR errMsg[256]; //buffer to store error message
// SWORD count;
USHORT *sqlState;
USHORT *errMsg;
sqlState= (USHORT *) malloc(sizeof(USHORT)*6);
errMsg= (USHORT *) malloc(sizeof(USHORT)*256);
SDWORD retcode3=NULL; // return code
SDWORD nativeErr; // native error code
SWORD realMsgLen; // real length of error message
// sprintf((char*)szSqlStr,"select name ,default_database_name,default_language_name from sys.sql_logins",buff);
// Allocate memory for ODBC Environment handle
cout<<"hEnv before SQLAllocEnv = "<<hEnv<<endl;
retcode= SQLAllocEnv (&hEnv);
cout<<"retcode= "<<retcode<<endl;
cout<<"hEnv after SQLAllocEnv = "<<hEnv<<endl;
cout<<"***********************";
// Allocate memory for the connection handle
cout<<"hDBC before SQLAllocConnect = "<<hDBC<<endl;
retcode= SQLAllocConnect (hEnv, &hDBC);
cout<<"retcode= "<<retcode<<endl;
cout<<"hDBC after SQLAllocConnect = "<<hDBC<<endl;
cout<<"***********************";
SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDBC);
// Connect to the data source using userid and password.
retcode = SQLConnect (hDBC, szDSN, SQL_NTS,szUID, SQL_NTS, szPasswd, SQL_NTS);
cout<<"retcode= "<<retcode<<endl;
if (retcode != SQL_SUCCESS )
{
retcode3 = SQLError(SQL_NULL_HDBC, hDBC, SQL_NULL_HSTMT, sqlState,&nativeErr,errMsg, 256, &realMsgLen);
// print_err(sqlState, nativeErr, errMsg, realMsgLen);
//print_err2(retcode,SQL_HANDLE_DBC,hDBC);
cout<<sqlState<<endl<<nativeErr<<endl<<errMsg<<endl<<realMsgLen;
}
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
cout<<"Connection established....!";
// Allocate memory for the statement handle
cout<<"hStmt before SQLAllocStmt = "<<hStmt<<endl;
retcode = SQLAllocStmt (hDBC, &hStmt);
cout<<"retcode= "<<retcode<<endl;
cout<<"hStmt after SQLAllocStmt = "<<hStmt<<endl;
cout<<"***********************";
/*
// Prepare the SQL statement by assigning it to the statement handle
retcode = SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr));
cout<<"Statement szSqlStr: "<<szSqlStr<<endl;
cout<<"Statement hStmt: "<<hStmt<<endl;
// Execute the SQL statement handle
retcode = SQLExecute (hStmt);
*/
retcode = SQLExecDirect(hStmt,szSqlStr, SQL_NTS);
UCHAR name[4000],defDBnm[4000],defLanguage[4000];
SDWORD retcode2, cbname, cbdefDBnm, cbdefLanguage;
retcode2=NULL;
if (retcode2 == SQL_SUCCESS)
{
retcode2 = SQLBindCol(hStmt, 1, SQL_C_CHAR, name, 4000, &cbname);
retcode2 = SQLBindCol(hStmt, 2, SQL_C_CHAR, defDBnm, 4000, &cbdefDBnm);
retcode2 = SQLBindCol(hStmt, 3, SQL_C_CHAR, defLanguage, 4000, &cbdefLanguage);
}
if (retcode2 != SQL_SUCCESS) /* warning or error returned */
{
retcode3 = SQLError(SQL_NULL_HDBC, hDBC, SQL_NULL_HSTMT, sqlState,&nativeErr,errMsg, 256, &realMsgLen);
//print_err(sqlState, nativeErr, errMsg, realMsgLen);
cout<<sqlState<<endl<<nativeErr<<endl<<errMsg<<endl<<realMsgLen;
}
cout <<"****************************************";
while (TRUE)
{
retcode2 = SQLFetch(hStmt);
if (retcode2 == SQL_SUCCESS || retcode2 == SQL_SUCCESS_WITH_INFO)
{
if (cbname == SQL_NULL_DATA) /* check null data */
printf("name: NULL");
else
printf("Name: %s", name);
if (cbdefDBnm == SQL_NULL_DATA)
printf("defDBnm name: NULL");
else
printf("defDBnm name: %s", defDBnm);
if (cbdefLanguage == SQL_NULL_DATA)
printf("defLanguage: NULL");
else
printf("defLanguage : %s", defLanguage);
}
else if (retcode2 == SQL_ERROR ) /* warning or error returned */
{
retcode3 = SQLError(SQL_NULL_HDBC, hDBC, SQL_NULL_HSTMT, sqlState,&nativeErr, errMsg, 256, &realMsgLen);
//print_err(sqlState, nativeErr, errMsg, realMsgLen);
cout<<sqlState<<endl<<nativeErr<<endl<<errMsg<<endl<<realMsgLen;
}
else /* if no more data or errors returned */
break;
}
// Project only column 1 which is the models
// SQLBindCol (hStmt, 1, SQL_C_CHAR, szModel, sizeof(szModel), &cbModel);
// Get row of data from the result set defined above in the statement
// retcode = SQLFetch (hStmt);
// Free the allocated statement handle
SQLFreeStmt (hStmt, SQL_DROP);
// Disconnect from datasource
SQLDisconnect (hDBC);
}
// Free the allocated connection handle
SQLFreeConnect (hDBC);
// Free the allocated ODBC environment handle
SQLFreeEnv (hEnv);
return 0;
}
void print_err2(RETCODE rc, SQLINTEGER type, SQLHANDLE handle)
{
//SQLCHAR SqlState, *sq = &SqlState[0];
SQLUSMALLINT *SqlState;
SqlState=(SQLUSMALLINT *) malloc (sizeof(SQLUSMALLINT)*6);
SQLUSMALLINT *sq = &SqlState[0];
SQLCHAR Msg[SQL_MAX_MESSAGE_LENGTH], *ms = &Msg[0];
SQLWCHAR SqlStateW, *sqw = &SqlStateW[0];
SQLWCHAR MsgW[SQL_MAX_MESSAGE_LENGTH], *msw = &MsgW[0];
SQLINTEGER NativeError;
SQLSMALLINT i=1, MsgLen;
RETCODE ret;
int j;
printf("Error number is %d", rc);
while (SQL_SUCCEEDED(SQLGetDiagRec(type, handle, i++,(unsigned short *) SqlState, &NativeError, (unsigned short *)Msg, sizeof(Msg), &MsgLen)) )
{
printf("State: %s Native Error Code: %d %s (%d)",
SqlState,NativeError,Msg, MsgLen);
}
}
Regards
Ketaki
View 3 Replies
View Related
Jul 5, 2007
Hello, all.
Why is it that, despite what is said in the sketchy SQL Help content, it appears to be impossible to cast a string to an integer in the Expression Builder to generate a value for a variable? More specifically, why does the following expression cause an error?
(DT_UI4) (SUBSTRING(@[User::FullDataPath], LEN(@[User:ataPath]) + 1, 2))
I'm iterating over files and using the name of a given file as an ID for an operation. I simply want to grab a file name using the Foreach Loop Container and process that file, while at the same time use the name in another operation. The file name will be something like "2.txt" (full path something like "c:somethingsomething2.txt"). I can use string functions to return the file name, which is a number as a string, and it should be no problem to cast that number as a string to a number (an Int32). SQL Server 2005 help has a chart that indicates such a cast is legal.
Maybe it's a crazy thing to be doing. Maybe I have to go about this a completely different way, but casting from "2" to 2 should be possible in the Expression Builder.
Thanks for any help.
View 7 Replies
View Related
May 15, 2008
(DT_DBTIMESTAMP)(TRIM("01-01-" + (DT_WSTR,4)(Year)))
Hello I want to know what is the significance of putting DT_DBTIMESTAMP and DT_WSTR in the above line,
Thanks
View 2 Replies
View Related
May 2, 2007
Hi all,
Actually trying to add one month to current variables value so I can process per month data in for loop for that I have written the following statement in Assign Expression Part of For Loop
dateadd("Month",1,((DT_DBDATE)(@[User::_year]+"/"+@[User::_month]+"/"+"01"))) here I am getting the error message that error converting from data type dt_wstr to to datatype dt_dbdate
@[User::_year] contains year value like 2003 and @[User::_month] contains month value like 1 using these variables I want to add the month to the date created by using these both variables.
so this is the first part to add the month to date and other part is to assign new value to variables by using datepart function
any help and guidance related to this whether I am doing right or not if any other wayout to acheive this goal.
View 1 Replies
View Related