Sunday, December 28, 2025
Home Blog Page 367

Save MySQL query results into a text or CSV file

MySQL provides an easy mechanism for writing the results of a select statement into a text file on the server. Using extended options of the INTO OUTFILE nomenclature, it is possible to create a comma separated value (CSV) which can be imported into a spreadsheet application such as OpenOffice or Excel or any other applciation which accepts data in CSV format.

Ignore duplicate entries in MySQL select using DISTINCT keyword

Sometimes every occurance of a value which may be duplicated multiple times in a result set is not needed. For example, if making a pulldown menu list of options, each option should be seen only once. The DISTINCT keyword in a select statement eliminates duplication in the result set.

Rename or change name of MySQL table

If you change your mind and want to rename an existing MySQL table, with or without data in it, it is no problem. One simple command will change the table’s name.

Copy an existing MySQL table to a new table

This is a great set of two commands that allow the creation and population of a new table with the structure and data of an existing table. This provides a quick means of making a point-in-time copy of a table and is a safe, easy way to make a quick copy of a table for testing an application in development on live data without risking a production environment.

Microsoft SQL Server: Determine MDAC Version

You can easily determine what version of MDAC your are running on your SQL Server by just typing a few lines into the query window. To do this:

Microsoft SQL Server: Determining CD Key

You can easily determine your CD key for your SQL Server software by just typing a few lines into the query window. To do this:

SQL Server – Get Physical Names and Attributes of Database Files

You can get the file location, size, maxsize, growth and usage attributes of a database without leaving your Enterprise Manager or Management Studio. To do this:

SQL Server 2005: How to Attach (or Reattach) a Database Missing the LDF

If you need to attach a database that has no log file (.LDF), or have deleted the log file because it was too big and need to reattach the database, SQL Server 2005 does allow you to do this. You can attach the database by following this Tech-Recipe:

SQL Server 2005: Configure Max Number of Characters Displayed in Each Column

It is sometimes necessary to modify the number of characters displayed in a query result set, especially when you are dealing with results containing a large number of columns. To configure the maximum number of characters displayed, do the following…

SQL Server 2005: Return a Comma Delimited Result Set from Queries

One almost always runs into a situation that requires a comma delimited result set from a query so that the data can be utilized by other software. Luckily, this is a native feature in the Query Editor.

SQL Server 2005: Include Column Headers When Copying Grid Query Results

Previous versions of SQL Server have featured the ability to create grid result sets from queries so that one can easily copy and paste the data into another application. Unfortunately, the column headers were not copied, so you then would have to go into the application and add the header by hand. SQL Server 2005 provides a new option that will allow you to copy the column headers with the data. Here is how to activate this handy option…

SQL Server 2005: How To Enable xp_cmdshell

As a security safeguard, Microsoft has turned off the use of xp_cmdshell by default in the latest version of SQL Server. This built-in extended stored procedure can come in quite handy as it gives you the ability to run any command line process from a stored procedure or job. To enable xp_cmdshell, do the following…

Latest Articles

Latest Reviews

Latest Comments

error: Content is protected !!