-
In my current project, we have a tables where the primary key consists of two values. Based on the result of a query, we needed to delete a few rows from that table. The query returned the two key values and we needed to join that information in the delete statement. It's not rocket science, but...
-
In my current project, we calculate the status of tasks that a user needs to do and store the status in a table. This happens on a daily basis. Once every week, we calculate which items are overdue and inform the user by email to take appropriate action. However, sometimes our users complain that they...
-
I was confronted with a slow performing stored procedure in SQL server this week. The procedure was to retrieve one row from a table. But before that row could be retrieved, an update procedure was called to make sure all rows in that table had the correct status. That update procedure first checked...
-
I was looking for a quick way to calculate the last day of the month in T-SQL and bumped into an article written by Gregory A. Larsen on DatabaseJournal.com . The article describes a number of T-SQL methods to calculate different date and time values. I used information from that article to create a...
-
At my current assignment, we have a number of applications that log extensively into a SQL server 2000 database table. These applications log thousands of rows per day, so you can imagine that this table contains huge numbers of rows after only a few weeks. We were asked to come up with a clean up procedure...
-
At the moment, I'm working on a conversion between 2 databases. I was looking for a way of avoiding the tedious job of creating command objects for each of the tables I needed to insert data into. In most projects I worked on over the last couple of years, I was able to use code generation to do this...