user7346629
user7346629

Reputation:

How do I open an existing query in SQL Server 2012 Management Studio?

I'm a beginner and in class we're learning how to make tables, insert records, make foreign keys all through query.

I've made a 3 tables through query but now I have to edit a previous table through it's own query but I closed it already. How do I open it again so I can add something to the table? All I see is the "New Query" button.

The tables are all in one file, under one database.To be more specific, I want to open query window that shows up when you click "New Query" but I want to see the codes I wrote to make the table because I need to edit something there.

Upvotes: 1

Views: 11191

Answers (2)

sam7
sam7

Reputation: 56

If you have saved your query earlier then open the folder which contains the sql code. Double click on that file, it will automatically open in SQL Server Management Studio.

Upvotes: 0

Amit Kumar Singh
Amit Kumar Singh

Reputation: 4475

You won't be able to re-open closed table script if it has not been saved in a .sql file. Check Kyle's comment above for single table. Re-generate the script.

For more than one table, right click on Database name, Select Tasks->Generate Scripts-->Click Next --> Select all tables you want. Save script on clipboard. Paste in New Query. Save that file as SQL.

You can use advanced options also to generate the same script.

Upvotes: 0

Related Questions