August 9, 2011 at 12:30 am
Hi All,
I have a script task that invokes a webservice. The response of the webservice is saved as a string.
I then call an execute sql task to save the response of the web service into a table with one column varchar(max).
The output of the webservice does not have the additional character but the subsequent step of saving the response into a table using SQL task adds an additional character ascii0 or nul.
What is adding this new character?
Thanks in advance
Aparna
August 9, 2011 at 1:53 am
ASCII 0 is equal to NULL, apparently.
If it bothers you, you can do a REPLACE(mySTring, CHAR(0), '').
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
August 9, 2011 at 2:34 am
Aparna-1 (8/9/2011)
Hi All,I have a script task that invokes a webservice. The response of the webservice is saved as a string.
I then call an execute sql task to save the response of the web service into a table with one column varchar(max).
The output of the webservice does not have the additional character but the subsequent step of saving the response into a table using SQL task adds an additional character ascii0 or nul.
What is adding this new character?
Thanks in advance
Aparna
ExecuteSQL does not add the ASCII 0 (which is different from a SQL Server NULL, by the way). Can you share the details of your ExecuteSQL task?
How are you checking that the Web service does not return the ASCII 0? This character is sometimes not visible, depending on the editor you are using.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
August 9, 2011 at 5:02 pm
Thanks Koen and Phil for your response.
I have implemented the workaround of replace string if it finds ascii(0).
However I was curious what was inserting this additional character. I checked that the web service task did not add the new character by checking thr right(string, 1) which was ">" char clearly end of xml tag.
Execute SQL task which inserted the value in the table, I checked the ascii(right(string, 1)) in the table and it had a value of 0 which makes me suspect it is the Execute SQL task.
After the Execute SQL task I called a script task and printed right(string, 1) and the subsequent task had the value of ">".
So i am guessing it is the Execute SQl task that has added ascii(0) which inserting into the table
August 10, 2011 at 12:53 am
The Execute SQL Task shouldn't add characters, so maybe the query that you use in the task manipulates the data in some way?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
August 10, 2011 at 4:55 pm
it is a simple insert statement
Insert into table
(
responsestring
)
values
(
@responsestring
)
BTW responsestring is declared as varchar(max)
For now I will go with the work around. Probably there is a bug somewhere that I am not able to figure out.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply