all groups > sql server (alternate) > august 2003 >
You're in the

sql server (alternate)

group:

TSQL Questions


TSQL Questions stevesusenet NO[at]SPAM yahoo.com
8/31/2003 2:08:34 PM
sql server (alternate):
Hi;

I'm brand spanking new to sqlserver ( nice so far ).

I need to make a simple data change across a list of tables.
Basically replace an old date with a new date.

However, the people I am doing it for want a program that produces
logging of what it does.

I thought I would write a tsql script and run it from query analyzer.
Like I said, the changes are simple, but there are some things my
clients want in the program that I am not sure how to do:


1. excute the *.sql file from query analyzer without pasting the code
into it.

2. connecting to the database in question from the tsql script,
programmatically

3. generating a list of tables that have 4 particular fields and then
programmatically ( tsql ) scrolling that table list searching for
records to be
updated.

4. outputting the table list, & logging records with the old dates
before the script runs and then afterwards.

Any pointers, ideas, or examples will be greatly appreciated

Re: TSQL Questions Our Man Abu
8/31/2003 10:27:00 PM
Sounds like you might want a trigger on the table(s) that require logging of
modifications. Requires a litle homework if you're a newbie.
[quoted text, click to view]

Re: TSQL Questions Ray Higdon
8/31/2003 11:42:27 PM
1. You can code an OSQL command line to run your sql script and put it
into a .bat file.

2. OSQL

3. Would need more info on this one, define what you mean by searching
for updates?

4. Using triggers is the best suggestion for this, you will need to
store the old records from the trigger special table called DELETED.

For one and two and possibly three, a quick web app might be a more
elegant approach.

HTH

Ray Higdon MCSE, MCDBA, CCNA

*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button