473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

TSQL Questions

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

Steve
Jul 20 '05 #1
2 5454
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.
"Steve" <st**********@yahoo.com> wrote in message
news:6f**************************@posting.google.c om...
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

Steve

Jul 20 '05 #2
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 ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve | last post by:
Hi; I have been writing a lot of short tsql scripts to fix a lot of tiny database issues. I was wondering if a could make an array of strings in tsql that I could process in a loop, something...
18
by: mountain man | last post by:
Greetings to all database professionals and laymen, Let us make a bold assumption that we have developed a software tool for the SQL Server environment which simply acts as an interface between...
2
by: dynoweb | last post by:
I have several *.sql files with schema/data changes to be applied to our current database. Is there a way to create a TSQL script that could be run from the SQL Query Analyzer that would...
1
by: TOM GUGGER | last post by:
OMNI GROUP tgugger@aimexec.com T-SQL/ CONTRACT TO PERM/ ATLANTA
3
by: David Lozzi | last post by:
Howdy, ISSUE 1: See issue 2 below. I have a distance calculator on my site which works great. However, the users need to sort by distance, which make sense. I'm not sure how to do it other than...
16
by: David Lozzi | last post by:
Hello, I have some code that adds a new user. The new user has a checkboxlist of items which they can be associated with. I would like to send this list of items to TSQL along with the new user...
7
by: Filips Benoit | last post by:
Dear all, Tables: COMPANY: COM_ID, COM_NAME, ..... PROPERTY: PRP_ID, PRP_NAME, PRP_DATATYPE_ID, PRP_DEFAULT_VALUE ( nvarchar) COMPANY_PROPERTY: CPROP_COM_ID, CPROP_PRP_ID, CPROP_VALUE...
8
by: David Lozzi | last post by:
I'm fairly new to ASP.Net 2.0 SQLDatasource objects. It defaults using TSQL statments for the SELECT, INSERT, UPDATE, DELETE commands, which is great and it works. However, I've always been taught...
0
by: DR | last post by:
Unable to start TSQL Debugging. Could not attach to SQL Server Process on 'srvname'. The RPC server is unavailable. I get this error when I try to run a SQL Server Project with a CLR stored...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.