Database tutorials

SQL Server 2005: Enforce Password Policy and Expiration

Contributed by shamanstears on February 6, 2007 under Database

Utilizing password policy and expiration can better secure your server and better protect the valuable data in your database. To enforce password policy and expiration for a login, follow these steps…

Comments
 

MySQL: Use CONCAT to include text in SELECT results

Contributed by qmchenry on January 31, 2007 under MySQL

The CONCAT function in MySQL allows SELECT statements to act like printf commands by mingling text and query results together.

Comments
 

SQL Server 2005: How To Set Up Database Mail

Contributed by shamanstears on January 24, 2007 under Database

SQL Server used to rely on SQL Mail to for email capabilities. This was a pain as it required you to install a MAPI mail client onto your server. SQL Server 2005 has done away with this and now uses Database mail which relies on using your SMTP server instead of a mail client to send out email. You can set up Database Mail by following these instructions…

Comments
 

SQL Server 2005: How To Enable xp_cmdshell

Contributed by shamanstears on under Database

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…

Comments
 

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

Contributed by shamanstears on under Database

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…

Comments
 

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

Contributed by shamanstears on under Database

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.

Comments
 

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

Contributed by shamanstears on under Database

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…

Comments
 

Mimic The MySQL LIMIT Feature in Microsoft SQL Server

Contributed by johnnythawte on November 20, 2006 under Database

MySQL includes a nifty feature that lets you select only rows 1-10, 11-20, or any set you want. Microsoft SQL Server does not include this feature. This recipe will show you how to mimic the same feature easily without stored procedures.

Comments