SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Other Development Tools
 Update SQL table script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

emailuser
Starting Member

44 Posts

Posted - 09/14/2011 :  07:06:54  Show Profile  Reply with Quote
Hi everyone , hope someone can help on my query ,

i have an sql server 2000 and a database called Data1, there is a table called status , which has columns for name , lastupdate, and status,

I am looking for a script to be run on each persons pc that we can add to the end of the users backup software to send the %username ( logged on user ) to the name column in the table, then send the current date to the lastupdate column, and finally a value to update the status table , .. i have tried several ways but cannot get it to work .. any help appreciated

visakh16
Very Important crosS Applying yaK Herder

India
47069 Posts

Posted - 09/14/2011 :  09:04:15  Show Profile  Reply with Quote
you mean automate script to be run in all client machines?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

emailuser
Starting Member

44 Posts

Posted - 09/14/2011 :  09:17:15  Show Profile  Reply with Quote
Hi , not really automate , just want a sql script to connect , update and disconnect , with the information above, i will then call this script from the backup software as a post command ... hope that makes sense
Go to Top of Page

emailuser
Starting Member

44 Posts

Posted - 10/04/2011 :  06:05:12  Show Profile  Reply with Quote
Hi .. anyone able to point me in the right direction , just looking how to do a simple script to update a database table that can be started from a users pc
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47069 Posts

Posted - 10/04/2011 :  06:22:42  Show Profile  Reply with Quote
quote:
Originally posted by emailuser

Hi .. anyone able to point me in the right direction , just looking how to do a simple script to update a database table that can be started from a users pc


shouldnt it be a simple update statement then?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

emailuser
Starting Member

44 Posts

Posted - 10/04/2011 :  07:25:45  Show Profile  Reply with Quote
i guess i see the stages like this

1 Make connection to database with username and password
2 Update table ( i would need to pass the users logon name )
3 Disconnect

can this all be rolled into one statement ? , how would i capture the users logon name ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47069 Posts

Posted - 10/04/2011 :  08:01:08  Show Profile  Reply with Quote
quote:
Originally posted by emailuser

i guess i see the stages like this

1 Make connection to database with username and password
2 Update table ( i would need to pass the users logon name )
3 Disconnect

can this all be rolled into one statement ? , how would i capture the users logon name ?


you can connect from client by loggin on to sql management studio
the run your query and disconnect from ssms

or was your question even to automate that?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

United Kingdom
22191 Posts

Posted - 10/04/2011 :  08:25:46  Show Profile  Reply with Quote
Could run OSQL from the command line? (is it still called that?)
Go to Top of Page

emailuser
Starting Member

44 Posts

Posted - 10/04/2011 :  08:55:02  Show Profile  Reply with Quote
Hi Visakh16 , the scenario is that i want to have this batch file on everyones desktop / laptop, once the backup software completes i want the script to run as said earlier , it should connect to the database update a table with username , todays date and a status flag , then disconnect, the idea being is that we then have a table which shows us who has backed up their data ,and when it happened .. howp that makes sense
Go to Top of Page

Kristen
Test

United Kingdom
22191 Posts

Posted - 10/04/2011 :  09:03:32  Show Profile  Reply with Quote
You can run an OSQL command from a batch file. That can conenct to the database and update the user's logon time etc.

(Provided its still called "OSQL" these days)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000