January 14, 2016 at 3:09 pm
I have a data output that looks like this:
code="sql"]SELECT A+|+B+|+C[/code]
Output is A|B|C similar to a text file.
Is there anyway that I can insert A, B, C into a table with a SQL query?
January 14, 2016 at 3:34 pm
imba (1/14/2016)
I have a data output that looks like this:
SELECT A+|+B+|+C
Output is A|B|C similar to a text file.
Is there anyway that I can insert A, B, C into a table with a SQL query?
Insert into what?
You can concatenate them into 1 column or you can update 3 different columns or some other combination.
Please provide the table definition that you are inserting into and where A, B and C are suppose to go and rules used to determine what gets inserted into what column if needed.
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 14, 2016 at 3:43 pm
The table contains three columns. A B C are always separated by a pipe.
January 14, 2016 at 4:16 pm
imba (1/14/2016)
I have a data output that looks like this:
SELECT A+|+B+|+C
Output is A|B|C similar to a text file.
Is there anyway that I can insert A, B, C into a table with a SQL query?
Your reply is still vague and you have not provided the ddl for either table or the rules used to determine what goes where.
Any Insert statement will do.
Insert someTable (colA, colB, colC)
Select 'A', 'B', 'C';
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 15, 2016 at 8:40 am
imba (1/14/2016)
I have a data output that looks like this:code="sql"]SELECT A+|+B+|+C[/code]
Output is A|B|C similar to a text file.
Is there anyway that I can insert A, B, C into a table with a SQL query?
Yes. Run it through a "splitter" and then pivot the data into separate columns. You can find a pretty good splitter at the following URL.
http://www.sqlservercentral.com/articles/Tally+Table/72993/
--Jeff Moden
Change is inevitable... Change for the better is not.
January 15, 2016 at 8:51 am
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply