really quick SQL Server question

Soldato
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
Hi all,

I have access to our works SQL Server Management Studio and all the live data. I am very new to it.

I need to change the owners of some orders, I think I know how but I can't get hold of the director who does this normally, I've had a message from the old dev who says "in the live sql box there is a sql script that does it. Just find the id to transfer from and to"

Any idea where the live sql box is?

I've looked and can create scripts from new but can't find anything to reference what we need.
 
Man of Honour
Joined
26 Dec 2003
Posts
30,883
Location
Shropshire
Sounds like he means there is a stored procedure or DTS/SSIS package in one of the DBs on the live server that can be run to achieve what you want.

He's using the words "Live SQL box" to reference the server you're already logged onto at a best guess.
 
Associate
Joined
25 Jun 2009
Posts
1,260
Location
Guernsey
Sounds like he means there is a stored procedure or DTS/SSIS package in one of the DBs on the live server that can be run to achieve what you want.

He's using the words "Live SQL box" to reference the server you're already logged onto at a best guess.

Yeah, that's how I read it too..
 
Soldato
OP
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
that's what I figured as well, but looking all over the place I've been unable to find anything that meets this. There's a standard replace procedure that covers the entire row for the table, but nothing specifically targeting ownership of an order.

Tech Director is over Tuesday or Wednesday, I'll ask him then whether what I've written is correct. I know it is to a point, it changes the info inside the order but not on the search page.
 
Man of Honour
Joined
19 Oct 2002
Posts
29,516
Location
Surrey
Please make sure you run the update on a test box first. No one will thank you for blitzing the wrong data on the live box.
 
Soldato
Joined
12 Dec 2006
Posts
5,137
The biggest problem with scripting a database is that it is easy to make make a mistake that effects far more records that you intended.
As a result, you really shouldn't be editing it unless you know what you are doing.
 
Associate
Joined
2 Aug 2004
Posts
564
Location
Adelaide
Given your experience of sql, I would strongly recommend not to do this, get someone who knows what they are doing. If you must make this change, run in a dev environment and only when you are 100% sure you are not breaking anything, back up prod and run there.
 
Permabanned
Joined
23 Apr 2014
Posts
23,553
Location
Hertfordshire
I would be learning the table structure and examine exactly what the script does first. At least then you understand what you are doing.

And make a backup before you do anything and/or backup and restore to a test database.
 
Soldato
Joined
12 Dec 2006
Posts
5,137
I would doubt he would be able to do that.

AHarvey you just can't wing it with SQL databases. They really shouldn't have asked you to go near it unless you have some training or been taken through it by someone who knows the database. I would advise you waiting for your colleague to return.

If you wreck the database. If they don't have a proper backup in place, you could cause massive problems. You might not even realise there is a problem for days or weeks.
 
Soldato
Joined
12 Dec 2006
Posts
5,137
... Then there's that moment when you expect it to say one record updated, but it runs a bit longer than expected and it says half a million. Then you notice you didn't select where at the end of your query....
 
Man of Honour
Joined
30 Oct 2003
Posts
13,251
Location
Essex
Echo what others have said, don't do it unless you know what you are looking at. As well as writing wrong code you could find yourself falling fail of triggers if you don't know the database schema. Put simply you could end up causing all kinds of problems. Most likely as tom_e has already said, there will be a stored procedure or similar that with a couple of variables will make the required updates. If you are not sure on what database, database server or script to run the safest thing to do is nothing at all. Wait until you can get hold of the people that do know and ask the right questions, don't try and be a hero ;)
 
Soldato
OP
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
I know enough about coding and a basic knowledge of SQL to get by, turns out what I had written was spot on, it's fairly logical, but the director is over on Wednesday and is going to give me a full crash course over the software and a few other tasks I can take over :)

Thanks for the advice though :) appreciate the responses
 
Soldato
Joined
1 Nov 2007
Posts
5,600
Location
England
DON'T RUN THIS ON PRODUCTION DATA FIRST! Make sure you know what you are doing on a backup / development server first and only once you are 100% sure everything is correct run it on production. Seriously.
 
Soldato
OP
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
"I have access to our works SQL Server Management Studio and all the live data. I am very new to it."

AWOOOOGA! AWOOOOOGA!

LOL, I've not broken anything yet, work on it daily now.

I've also applied, and IF they decide there is a second place available will be moving to a full time SQL analysts job in Stoke :D
 
Back
Top Bottom