I have the string value like:
string1:string2:string3:string4:2.90
I need to fetch from this string 2.90
Could you please help me with the implementation of it?
Please try the following SSIS Expression.
TOKEN(#[User::input], ":", TOKENCOUNT(#[User::input], ":"))
TOKEN() and TOKENCOUNT() SSIS functions are very handy for your scenario:
TOKENCOUNT (SSIS Expression)
Related
In flink sql, how to check whether a string is a number, as
select * from input where str like '\\d+'
the regular expression seems not useful, and the 'similar to' operator can't work either. Is there some idea?
Try defining a scalar function, here,
https://ci.apache.org/projects/flink/flink-docs-release-1.7/dev/table/udfs.html#scalar-functions
I have a field JSONStructure which has NT_TEXT Data Type and have to do a replace function on that.But, It looks like I cannot do a replace function on column having DT_NText DataType. I tried using Data conversion in SSIS But my JSONStructure can have more than 8000 characters and It is not working.
Can someone suggest me the best way to do it.
Thanks in Advance.
I think you'll need to use a Script Component, acting as a Transformation, and you'll need to specify that the column is read/write and then use C#/VB.NET string methods to perform the string manipulation
I am unable to convert the following SQL to a corresponding SSIS expression
and cast it to DATE format
SUBSTRING(A.FILENAME,13,2)+'-'+SUBSTRING(A.FILENAME,15,2)+'-'+SUBSTRING(A.FILENAME,17,4)
This is the best I could get
DT_DATE(SUBSTRING(#[User::V_LoadFileName],13,2)+'-'+SUBSTRING(#[User::V_LoadFileName],15,2)+''+SUBSTRING(#[User::V_LoadFileName],17,4))
Any suggestions?
String to cast to Date in SSIS has to be YYYY-MM-DD.
If you want to cast String to Datetime, it should be YYYY-MM-DD HH:MIS:SS.
The reasoning for the formatted data in Ferdipux's answer is that your environment may not be using the same style of DATE (i.e. YYYY/MM/DD vs YYYY/DD/MM).
Also, your example has syntax problems. Casting in SSIS is a little odd. You close your parenthesis BEFORE the variable.
(DT_BOOL)"0" returns FALSE
Note also the use of TWO quotations in SSIS. So you will likely need to use '"' in your script to work.
Some examples of casting in SSIS:
( «type» ) «expression»
(DT_I4)
(DT_STR, «length», «codepage» )
(DT_DATE)
(DT_BOOL)
(DT_WSTR, «length» )
(DT_NUMERIC, «precision», «scale» )
(DT_DECIMAL, «scale» )
(DT_DBTIMESTAMP)
Lastly, if you can, use the Expression Tester. Made life REALLY easy for me in designing my own SSIS packages. :D
http://expressioneditor.codeplex.com/
I have a string like
`...<..../><... id='someID' .../><...../>....`
(the total length of that string is more than 15k chars, it's an XML form definition)
Inside of that string I have the someID value. I want to put after the element containing that value a new string:
...<..../><... id='someID' .../><my_new_string><...../>....
I tried to split that long string basing on the someID value, but that approach is too slow. How can I achieve that on the other way ?
Or maybe is it possible to select the substring <... id='someID' .../> ?
SQL server can work with XML. You do not need to use substring.
A simular problem was solved on this page: xml.modify
Have you tried using Replace? For example:
REPLACE(yourString, yourPattern, yourPattern + newString);
Using your example, it would look something like:
REPLACE('...<..../><... id='someID' .../><...../>....',
'<... id=''someID'' .../>',
'<... id=''someID'' .../><my_new_string>');
Please notice I escaped the ' characters around "someID".
Best regards.
It isn't clear what data type your string is: xml or (n)varchar? For xml, you can use the various data type methods; for (n)varchar the STUFF() function inserts one string into another string.
I have the following code used to search the data in the dataset:
DataRow[] filteredRows =
myDS
.Tables["Inventory"]
.Select(string.Format("Make LIKE '%{0}%'", keyword));
however, if the keyword contains data such as O'Henry then above command will failed. I can get over this with parameterized with SQLCommand. But I have no idea how to use parameterized with dataset.
Any idea, please?
You need to replace ' with ''. (two single-quote characters)