Thursday 12 May 2016

How to save query results into excel file with column names in mysql


Include headers when using SELECT INTO OUTFILE?


If you ever tried the above scenario, your solution is here.


If you are using MySQL Workbench, you can achieve the same with the help of Export\Import icon in the query output window.

Please refer the image below for the same.

Execute the query which you would like to extract. Then click highlighted icon shown above

Browse desired path and choose Excel Spreadsheet as Save as type in File Dialog Box.














































Tuesday 10 May 2016

Snippets in SQL Server Management Studio(SSMS)


SQL Server Management studio offers simple snippets which helps to create objects of  the Database with ease without bothering much about the syntax of each object.

Snippets can be included in the query window either by browsing through
Edit->IntelliSense->InsertSnippet... or (Keyboard shortcut Ctrl K+X)

(or)

Edit->IntelliSense->SurroundWith..or (Keyboard shortcut Ctrl K+S)

Please have a look at the picture below for details of the above mentioned keyboard shortcuts.












Above picture shows the Begin End, If and While block Construct which you can include anywhere in the query window just by hitting the keyboard shortcut of Ctrl K+S.




Above picture shows the object creation template(table in the above case). By clicking on any of the listed object, respective construct will be shown for the user to edit.