Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rcapilli
Starting Member
1 Post |
Posted - 2010-02-24 : 12:18:59
|
| Is there a way to take text (from any program, notepad?):col1 nvarchar(500) Checkedcol2 int Checkedand paste/build a column in a table with the info above?[COLUMN NAME] [TYPE] [ALLOW NULL]col1 nvarchar(500) Checkedcol2 int Checked |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-24 : 12:22:25
|
| You have text data with 3 columns, delimited by spaces, and with each row separated by CR / LF, and you want to insert them into a table with three, corresponding, columns?Then "yes"BCP will do this (as a batch operation)Or SQL server provides a tool called SSIS which will get "flat file" data into a tableOr you can have some SQL code that will "split" each row at the CR / LF, and then split each "column" at the space. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-24 : 12:36:46
|
| I dont think you can do that without using dynamic sql. B/w is this MS SQL Server? what does checked mean?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-25 : 02:05:52
|
quote: Originally posted by Kristen You have text data with 3 columns, delimited by spaces, and with each row separated by CR / LF, and you want to insert them into a table with three, corresponding, columns?Then "yes"BCP will do this (as a batch operation)Or SQL server provides a tool called SSIS which will get "flat file" data into a tableOr you can have some SQL code that will "split" each row at the CR / LF, and then split each "column" at the space.
OP specified that Column informations are available in the text file (not actual data) and a table should be created based on the informations. It is not as easy as you import data. As Visakh said, only way is dynamic SQLMadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-25 : 02:22:15
|
| " a table should be created based on the informations"I didn't read it that way, But I realised that could be the meaning, which is why I asked for clarification.But O/P is AWOL ... |
 |
|
|
|
|
|
|
|