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 |
kwirky
Starting Member
8 Posts |
Posted - 2010-08-05 : 20:30:14
|
Can anyone advise how to do a large update of data through SQL?I will have a bunch of data which is in an Excel spreadsheet which needs to be updated, and when it is a logical set of data, I usually copy and paste into Access, however sometimes this is too difficult based on what changes are needed.So to get around this, I have been using Excel to concatenate an UPDATE statement (UPDATE {table} set {field1} = xyz" where {field2} = 'abc')I will fill as many lines as necessary with similar entries and then copy and paste the whole lot (sometimes as many as 1000 entries) into a query.So the end result would be something like this:UPDATE {table} set {field1} = xyz" where {field2} = 'abc'UPDATE {table} set {field1} = xyz" where {field2} = 'abc'UPDATE {table} set {field1} = xyz" where {field2} = 'abc'UPDATE {table} set {field1} = xyz" where {field2} = 'abc'etc (all the lines would have different data on them)This would then update the table and the messages would be (1 row completed) as many as 1000 or more times.Although this gets the job done effectively, is there a more correct or glamorous way to do this?ThanksKwirky |
|
Sachin.Nand
2937 Posts |
Posted - 2010-08-06 : 00:55:25
|
How many types of different data do you have?Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|