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 |
|
dmilam
Posting Yak Master
185 Posts |
Posted - 2010-03-02 : 17:26:23
|
| Hello,First post here. Because I do not have BULK INSERT permissions... yes, it's frustrating!I need to insert a long, long series of strings into a table, but I'm not sure how to accomplish this, given that the strings do not exist in any other table to begin with. Essentially I need to place 'string1','string2', [...] into a one-column temp table, then go from there.Any help appreciated! |
|
|
Skorch
Constraint Violating Yak Guru
300 Posts |
Posted - 2010-03-02 : 17:39:26
|
| I usually just copy paste the values into a text editor (Notepad++ is free and great) and then use its functions to add the rest of the text to each row:INSERT #YourTable (ColumnName)SELECT 'string1' UNION ALLSELECT 'string2' UNION ALL..etc.Some days you're the dog, and some days you're the fire hydrant. |
 |
|
|
dmilam
Posting Yak Master
185 Posts |
Posted - 2010-03-02 : 17:45:07
|
| Thanks, Skorch. I've been banging my head around SSMS Express for an hour, forgetting about simple text functions like replace.Man, today is definitely a fire hydrant day. |
 |
|
|
Skorch
Constraint Violating Yak Guru
300 Posts |
Posted - 2010-03-02 : 18:15:34
|
| No problem :)Some days you're the dog, and some days you're the fire hydrant. |
 |
|
|
dmilam
Posting Yak Master
185 Posts |
Posted - 2010-03-03 : 15:33:56
|
| Here's another method, pointed out by a co-worker, which reduces execution time.Create a temp table to hold your data. > CREATE TABLE #temp (ID INT NOT NULL) Format your string series in Notepad++ (much less of a resource hog that plain Notepad, I've found)Copy that formatted series into your temp table, by opening Object Explorer, right clicking on the temp table, Open Table, right click on the row, paste. |
 |
|
|
|
|
|
|
|