Using dateadd in SQL Server to add intervals to dates
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.
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.
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.
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.
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.
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.
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.