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 |
waldo3840
Starting Member
3 Posts |
Posted - 2013-08-06 : 14:44:49
|
Hi All,Really new to SQL and trying to find an easier way to get a job done.I have a program that was created by another person that uses SQL2005 and now requires a CMD command to Update certain tables for reasons beyond my understanding. Before he left i was advised before Syncing my program i have to go to CMD (run as admin) and type the following:OSQL -S .\SQLEXPRESS -EAfter typing that the lines following appear as 1> 2> 3> etc.Next to these i have to type;1> USE "DATABASE"2> UPDATE TGAME SET BDIRTY = 13> GOI tried to create a .bat file to do it for me but only fills in the OSQL -S .\SQLEXPRESS -E and leaves me with the 1>.Is there a way to create the whole process in a .bat file? Im not the only one who needs this process and am not sure how to stop it from requiring these step so im trying to make it as simple as possible.Thanks in advance. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-08-06 : 14:53:52
|
Let my first ask why you have chosen the path to use external command to update a database?I want to know this before I may give some advice that will let you continue do things the wrong way. Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-08-06 : 14:57:41
|
First one bat file that contains this textOSQL -S .\SQLEXPRESS -E -i "c:\temp\my files\sql.txt"then a text file named sql.txt in the path aboveUSE DATABASEGOUPDATE TGAME SET BDIRTY = 1GO Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
 |
|
waldo3840
Starting Member
3 Posts |
Posted - 2013-08-06 : 14:58:21
|
I can appreciate that :). I have never used SQL before and though the instructions are easy enough to follow - being only 4 sentences, there are a few of my employees that may not be able to follow them so easily. So as i have no knowledge of how it works, i can only rely on the instruction given to me to be able to update. They never used to be needed but now are. If there is an easier way then having to do the commands externally or even fix the issue completely it would be preferred. Thanks |
 |
|
waldo3840
Starting Member
3 Posts |
Posted - 2013-08-06 : 15:07:02
|
quote: Originally posted by SwePeso First one bat file that contains this textOSQL -S .\SQLEXPRESS -E -i "c:\temp\my files\sql.txt"then a text file named sql.txt in the path aboveUSE DATABASEGOUPDATE TGAME SET BDIRTY = 1GO Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Worked perfectly, thankyou! |
 |
|
|
|
|
|
|