Microsoft SQL Server

Help and howtos for Microsoft SQL Server

Microsoft SQL Server is Microsoft's relational database management system (RDBMS). Microsoft originally worked with Sybase on earlier versions but later parted company and Sybase renamed their version more recently to Sybase Adaptive Server Enterprise. The current version of SQL Server is SQL Server 2008 R2.

Post sort order: Post Date (Newest First) | Post Date (Oldest First) | Alphabetical | Date Updated

SQL Server Express 2008 did not install successfully

Posted in Microsoft SQL Server -

While attempting to install Visual Web Developer Express 2010 SP1 on Windows 2003 Server I got the error message "SQL Server Express 2008 R2 - This product did not install successfully."

Connect to SQL Server through an SSH tunnel

Posted in Microsoft SQL Server -

I recently needed to connect to a Microsoft SQL Server which I couldn't reach directly, but which is visible from a web facing Linux machine. I've covered how to create an SSH tunnel on Windows with PuTTY already and then it's simply a matter of connecting through the tunnel on the localhost to the SQL Server at the other end.

Connect to a different port with SQL Server Management Studio

Posted in Microsoft SQL Server -

Microsoft's SQL Server Management Studio will connect by default to port 1433 and there's nowhere in the connect dialog to specify a different port from the default. To connect using a different port specify the servername, a comma, and then the port number as shown in this post.

Using dateadd in SQL Server to add intervals to dates

Posted in Microsoft SQL Server -

Last week I posted how to use date_add() in MySQL to add intervals to dates and today I will do the same but for Microsoft SQL Server using the dateadd() function.

Export selected data from SQL Server to a tab file with bcp

Posted in Microsoft SQL Server -

This post is a follow up to yesterday's post titled "Export data from SQL Server to a tab file with bcp". In this post we will again export data from a SQL Server table into a tab file but this time will select which data we want to export. This means you can export just a subset of data from a large table. You could also join multiple tables and export to one file.

Export data from SQL Server to a tab file with bcp

Posted in Microsoft SQL Server -

The bcp command line tool allows you to import and export data from a SQL Server database into a text file. There is also a freebcp tool from the FreeTDS library so you can do this from Linux/Unix boxes as well. This post looks at how to export data from SQL Server into a tab file using bcp/freebcp.

Check Index Fragmentation with SQL Server 2000/2005

Posted in Microsoft SQL Server -

This post looks at how to check if an index is fragmented in a Microsoft SQL Server table and how to rebuild the index. The advice offered in this post works for both SQL Server 2000 and SQL Server 2005 although the methods are deprecated for SQL Server 2005 and are likely to be dropped in the next release. I will look at the alternate way of doing this for SQL Server 2005 in a later post.

Unable to modify table, timeout expired errors with Microsoft SQL Server

Posted in Microsoft SQL Server -

While modifying a table in Microsoft SQL Server with about 10 million records in it, I got the error message "unable to modify table - timeout expired..." and the table was not able to be modified. The solution was to change the timeout settings which is covered in this post.

List stored procedures with MS SQL Server

Posted in Microsoft SQL Server -

This is the third and final post in a series about using the sp_tables, sp_columns and sp_stored_procedures stored procedures with Microsoft SQL Server databases. This post is about sp_stored_procedures which is used to get a list of stored procedures in a SQL Server database.

Describe table structure with MS SQL Server

Posted in Microsoft SQL Server -

This is the second in a series of three posts about using the sp_tables, sp_columns and sp_stored_procedures stored procedures with Microsoft SQL Server databases. This post is about sp_columns which is used to describe the table structure of a SQL Server table.

Get a list of tables with MS SQL Server

Posted in Microsoft SQL Server -

I've recently been doing some work with Microsoft SQL Server but the server itself for this particular customer is behind a firewall and I have no way currently of connecting with the SQL Server tools, so have to access it via some PHP scripts running on a webserver inside the network. This is the first in a series of three posts about using the sp_tables, sp_columns and sp_stored_procedures stored proecedures about SQL Server databases. This first post looks at sp_tables.