Microsoft SQL Server - oldest to most recent
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 2005, with SQL Server 2008 due to be released later this year.
Post sort order: Post Date (Newest First) | Post Date (Oldest First) | Alphabetical | Date Updated
The user is not associated with a trusted SQL Server connection
Posted June 21st, 2008 in Microsoft SQL Server
Microsoft SQL Server allows you to connect using "windows authentication mode", which means using Windows logins, and "SQL Server AND windows authentication mode". In you create a SQL Server user and don't have the SQL Server authentication mode enabled, you won't be able to log in using that login, and will get error message 18452: "The user is not associated with a trusted SQL Server connection". This post looks at the error message and how to enable the appropriate authentication mode.
Get a list of tables with MS SQL Server
Posted July 16th, 2008 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.
Describe table structure with MS SQL Server
Posted July 23rd, 2008 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.
List stored procedures with MS SQL Server
Posted July 30th, 2008 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.
Unable to modify table, timeout expired errors with Microsoft SQL Server
Posted August 12th, 2008 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.
Check Index Fragmentation with SQL Server 2000/2005
Posted August 22nd, 2008 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.
Export data from SQL Server to a tab file with bcp
Posted September 8th, 2008 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.
Export selected data from SQL Server to a tab file with bcp
Posted September 9th, 2008 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.
Using Cursors with Microsoft SQL Server
Posted September 19th, 2008 in Microsoft SQL Server
Just about everything I've ever read about cursors for Microsoft SQL Server say not to use them for a variety of reasons. There are some cases where using a cursor is a lot simpler or faster etc than using another method and so I've decided to quickly document an examaple of a SQL Server cursor here for my own reference.
Using dateadd in SQL Server to add intervals to dates
Posted October 4th, 2008 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.
