Nov 30, 2007
I have a query in SSIS which works fine.
SELECT SUBSTR(DOB_CHAR, 7, 2) AS EXP3, SUBSTR(DOB_CHAR, 5, 2) AS EXPR1, SUBSTR(DOB_CHAR, 1, 4) AS EXPR2
FROM WAITLIST
results
20
12
1948
07
09
1982
29
07
1960
However, when I try to concatinate, it falls over
SELECT SUBSTR(DOB_CHAR, 7, 2) + '/' + SUBSTR(DOB_CHAR, 5, 2) + '/' + SUBSTR(DOB_CHAR, 1, 4) AS EXPR2
FROM WAITLIST
The syntax works ok on SQL Server query, but not in SSIS.
(Reading from Oracle, number 19481220, an is varchar2)
Select will work with pipes (as in oracle) but it must be of the form | | '/' | |
that is
SUBSTR(DOB_CHAR, 7, 2) | | '/' | | SUBSTR(DOB_CHAR, 5, 2) | | '/' | | SUBSTR(DOB_CHAR, 1, 4) AS EXP2
I would like to know if this is correct, or is it because I am reading from Oracle?
I do get an error message in query builder, but the query then runs as required.
Error in list of function arguments: '|' not recognized.
Error in list of function arguments: ',' not recognized.
Error in list of function arguments: ')' not recognized.
Unable to parse query text.
Any views?
View 4 Replies
View Related
Mar 22, 2007
I have a need to query some data and string all my results by id. I am fairly close to the results but stuck on the final piece. Any help would be greatly appreciated.
Here's the scenario: My data looks as follows:
UserID
Results
1095
,,,,,,,
1095
,,,,,8,,
1095
,,,,,,,
1095
,,,,,8,,
1247
,2,3,,,6,,,
1247
,2,3,,,6,,,
1247
,2,3,,,6,,,
1247
,2,3,,,6,,,
4069
,,,,,,,
4069
,,,,,,,
4069
,,,,,,,
4069
,,,,,,,
4070
,,6,,,,,
4070
,,6,,,,,
4070
,,6,,,,,
4070
,,6,,,,,
I want to query it and end up with the results all strung together under each UserID as follows:
1095
,,,,,,,,,,,,8,,,,,,,,,,,,,,8,,
1247
,2,3,,,6,,,,2,3,,,6,,,,2,3,,,6,,,,2,3,,,6,,,
4069
,,,,,,,,,,,,,,,,,,,,,,,,,,,,
4070
,,6,,,,,,,6,,,,,,,6,,,,,,,6,,,,,
I know if I use the following code I can string all the results together
select *, Cast((SELECT Results + ',' FROM #temp1 FOR XML PATH('')) as varchar(max) ) as Results from #temp1
But I can't figure out how to break it down by individual UserID. Any help is greatly appreciated. Thanks in advance
View 11 Replies
View Related