Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving .sql queries as .sql text file

Beginner's question: I am learning SQL and the book says 'SQL queries can be created as an SQL script which can be saved as a plain text file with a .sql file extension.' presumably this is done in Notepad but how do I save it as a .sql script please?

like image 686
patrick Avatar asked Aug 02 '15 07:08

patrick


People also ask

How do I save a SQL query result in a text file?

Click Query, and then click Results to File. Enter and then execute the SQL statement. In the Save Results dialog box, specify the following settings: Save In: Select a directory in which to save the file.

How do I create a .SQL file in Notepad?

Create a script file To create a simple Transact-SQL script file by using Notepad, follow these steps: Click Start, point to All Programs, point to Accessories, and then click Notepad. Save the file as myScript. sql in the C drive.

Can you save SQL queries?

To save a query: Use the Save command in the application toolbar. In the Save File As window, choose a name and a location to save your query.


1 Answers

To save a file as sql file in notepad - save the file as "yourFile.sql" as in the below picture.

Make sure to select "All Types ." instead of "Normal text file (*.txt)"! Else it will be saved as script.sql.txt.

Screenshot of how to save sql file from notepad

like image 67
Ilessa Avatar answered Oct 10 '22 23:10

Ilessa