views:

56

answers:

4

Is there any handy tool that can make updating tables easier? Usually I got an Excel file with the original value in one column and new value in another column. Then I write a formula in Excel to create the 'update' statement. Is there any way to simplify the updating task?

I believe the approach in SQL server 2000 and 2005 would be different, so could we discuss them both? Thanks.

In addition, these updates usually request by "non-programmer" (which means they don't understand SQL, so it may not feasible to let them do query), is there any tool that can let them update the table directly without having DBAs do this task? Also, that tool needs to limit the privilege to only modify certain tables. And better has a way rollback the change.

+4  A: 

Create a DTS package that will import a csv file, make the updates and then archives the file. The user can drop the file in a specific folder designated for the task or this can be done by an ops person. Schedule the DTS to run every hour, day, etc.

buckbova
In SQL Server 2005, SSIS is the improved DTS. Not sure about DTS but SSIS supports Excel files as source so in that case CSV would not be needed.In fact, the asker probably doesn't need to use DTS at all. Seems that they've got both 2000/2005 in the house so Stan could use the SSIS running on a SQL Server 2005 installation to get data into a SQL Server 2000 DB.
Valentino Vranken
A: 

You could create some accounts in SQL Server for these users and limit their access to only certain tables and columns along with onlu select / update / insert privileges. Then you could create an access database with linked tables to these.

Khorkrak
+1  A: 

I think the best approach is to expose a view on your data accessible to users who are allowed to do updates, and set up triggers on the view to perform the actual updates on the underlying data. Restrict change to only the columns they should be changing.

This technique can work on SQL Server 2000 and 2005.

I would add audit triggers on the underlying tables so you can always track changes.

You'll have complete control, and they can connect to it with Access or whatever and perform their maintenance.

Cade Roux
+1  A: 

In case your users would insist that they keep using Excel, you've got several different possibilities of getting the data transferred to SQL Server. My preferred one would be to use DTS/SSIS, as mentioned by buckbova.

However, another method is by using OPENROWSET(), which makes it possible to query your Excel file as if it was a table. I wrote a small article about it here: http://blog.hoegaerden.be/2010/03/29/retrieving-data-from-excel/

Another approach that hasn't been mentioned yet (I'm not a big fan of letting regular users edit data directly in the DB), any possibility of creating a small custom application for them?

There you go, a couple more possible solutions :-)

Valentino.

Valentino Vranken
Not necessary to use Excel. But for sure they don't have access to DB, I think a small custom application to modify DB is a good idea. So I wonder are there a lot development people create web-based application for non-dev people to modify DB in browser? Please advise.
Stan
I'm quite sure that that is indeed a common practice. My personal experience (as a BI developer) is the following: the business people want/need to maintain some fixed data, such as mapping data to map business keys from one system to those of another system. Maintaining this data is usually done through a custom web app. This gives you full control over the end result (data in a table somewhere) while the business guys can use an appealing interface.
Valentino Vranken