Link to home
Start Free TrialLog in
Avatar of pstre
pstre

asked on

SQL Server 2012

Out IT dept built a new SQL server. I have quite a few SQL statements that I need to move to the new server.  How can I do this?
Avatar of Tom Chadaravicius
Tom Chadaravicius
Flag of United States of America image

Use SQL Management Studio, or Navicat for SQL server.
You say, "quite a few" - export from the old server and import into the new server.
Avatar of Aneesh
I am assuming you are planning to move the databases from old server to a new server. Before you start, you need to gather the login credentials, then find out what applications are using those databases and make a plan to change the connection strings, then you move the databases either taking the databases  offline, the copying the database files over and attaching them or thru a backup restore method.
Better you do this on test server first
Avatar of pstre
pstre

ASKER

Aneesh, I wasn't asking about the databases or the login credentials.  I am asking about SQL statements
As SQL Statements are pure ascii text, copy them to text files on disk on the old server and paste them from those files to the new server.

OR Do you mean that you have SQL Peocedures and/or functions compiled on the old server that you sould like to move to the new server?

More info would help us to answer.
ASKER CERTIFIED SOLUTION
Avatar of pstre
pstre

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
HI,

If you want to copy the stored procedure / Views / functions you can right click on database and click on generate script.

Then select relevant objects and your script will be generated which you can save and run on the destination server.
Avatar of pstre

ASKER

I figured it out -- didn't understand the 2 answers others had given.  I selected several statements at one time, right clicked and selected copy.  I then went to the new SQL server and "pasted"