Mar 122013

Escaping an apostrophe or a quote in MySQL can be done by putting a \ (backslash) in front of them.

Example: insert into tablename (columnname) values ('It\'s time to eat.');

Escaping an apostrophe or quote in MSSQL can be done by doubling up the apostrophe or quote.

Example: insert into tablename (columnname) values ('It''s time to eat.');
Source: from
Sep 042011
 yum -y install phpMyAdmin php-mysql php-mcrypt

 vi /etc/httpd/conf.d/phpMyAdmin.conf

 Change line 14 and add any IP address that you want to allow access to your phpmyadmin web page.
 By default it will allow the local host: Allow from
 You can add any computer on your domain: Allow from
 This is assuming your domain IP address range is
 Alternatively, you can add access to any computer by changing the line to read: Allow from All
 You should setup SSL access to your server if you are going to allow all.

 Save the changes and restart httpd by typing:
 	sudo /etc/rc.d/init.d/httpd reload
 	sudo service httpd restart  

Example of phpMyAdmin.conf file:

# phpMyAdmin - Web based MySQL browser written in php
# Allows only localhost by default
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   Order Deny,Allow
   Deny from All
   Allow from
   Allow from ::1

<Directory /usr/share/phpMyAdmin/setup/>
   Order Deny,Allow
   Deny from All
   Allow from
   Allow from ::1

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>
Jun 292011

To set CPU idle time and duration

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
  2. Right-click SQL Server Agent, click Properties, and select the Advanced page.
  3. Under Idle CPU condition, do the following:
    • Check Define idle CPU condition.
    • Specify a percentage for the Average CPU usage falls below (across all CPUs) box. This sets the usage level that the CPU must fall below before it is considered idle.
    • Specify a number of seconds for the And remains below this level for box. This sets the duration that the minimum CPU usage must remain at before it is considered idle.
Jun 242011

EXEC sp_MSforeachtable @command1 = “DROP TABLE ?”

This is a hidden SP in sql server, this will be executed for each table in the database you connected (you cant rollback this)
If u want to delete it from the command prompt try this

EXEC xp_cmdshell ‘SQLCMD -U <user> -P <password> -Q ‘EXEC sp_MSforeachtable @command1 = “DROP TABLE ?” ‘ ,no_output

Delete/truncate all the Data from each table for in the database you connected

EXEC sp_MSforeachtable @command1 = “DELETE FROM ?”
EXEC sp_MSforeachtable @command1 = “TRUNCATE TABLE ?”

I too explain it now, as sp_MSforeachtable is Stored Procedure, that will execute for all the tables for database & @command1  is variable which will run against each table for connected database, now whatever you will write in the double quotes, that will be act as a command for each table, where ‘?’ is the name of the table.
try this, it will clear your comcepts

EXEC sp_MSforeachtable @command1 = “SELECT * FROM ?”  — Selects all the rows form all the table
EXEC sp_MSforeachtable @command1 = “PRINT ‘?'” –Just print the tables names with owner(dbo)

For more understanding, go for the MSDN or google, this is the right way.

Link to source

Jan 052010

If you are having connectivity problems specify the database name in the box that asks “Which SQL Server do you want to connect to?” For instance, Computername\SQLEXPRESS.

You can also use the command line ‘sqlcmd’ to access SQL Server Express.
It is a pain to use but it works. You can write your code in a text
file then import it using the sqlcmd command. You also have to end
your query with a new line and type the word ‘go’.

Example of query file named test.sql:
 use master;
 select name, crdate from sysdatabases where xtype='u' order by crdate desc;
Example of sqlcmd:
 sqlcmd -S %computername%\RLH -d play -i "test.sql" -o outfile.sql & notepad outfile.sql