Tip #1: Be Very Careful Naming Your SQL Objects
This one caught me completely by surprise! Having successfully run through the SQL Adapter (BizTalk Server Sample) in the SDK, I thought I had the basics down pretty well but for some mysterious reason I couldn't get the SQL Adapter to insert records into my database table. The error "XML encoding or decoding error occurred with a SQL object name" was rather cryptic as well. I posted this to the public newsgroups with no luck until I found this little tidbit of gold in the documentation.
Database object names (tables, columns, stored procedures, and parameters), which are retrieved from sysobjects need to be scanned for the following special characters.
! @ # $ % ^ & * ( ) _ - + = { [ } ] | \ : ; " ' < , > . ? / ~ `
If one or more are present, add an XSD restriction to the schema.
Not being an expert in XSD, I did the next best thing and changed my table's column names from "po_date" to "podate", revised the schema to match and now everything works great!
Tip #2: Beware of Date/Time Formats
Another one that caught me by surprise! The SQL Send Adapter (I suspect this is due to SQLXML) requires your date/time formats to be in a very specific format as shown below or the conversion will fail.
1999-05-31T13:20:00.000
To accomplish this I use a Scripting Functoid in my map using the Inline C# code shown here.
public string SQLDate(string strMyDateTime)
{
System.DateTime myDateTime = System.DateTime.Parse(strMyDateTime);
string curdate = myDateTime.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
string curtime = myDateTime.ToString("T",System.Globalization.CultureInfo.InvariantCulture);
string retval = curdate + "T" + curtime + ".000";
return retval;
}
Anyone care to explain why the SQL Adapter can't just convert from the xs:date to the SQL datetime format?
Posted
08-03-2004 6:44 PM
by
Jeff Lynch