DB2 TRUNCATE Clause
The equivalent of the SQL Server TRUNCATE clause for DB2 v8 is
ALTER TABLE {TABLE-NAME} ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE
The equivalent of the SQL Server TRUNCATE clause for DB2 v8 is
ALTER TABLE {TABLE-NAME} ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE
Here’s a succinct way of generating SELECT COUNT(*) against all tables in a DB2 database.
SELECT 'SELECT COUNT(*) AS COUNT_' || TABLE_NAME || ' FROM ' || TABLE_SCHEMA || '.' || TABLE_NAME FROM sysibm.TABLES ORDER BY TABLE_NAME
This returns output like the following:
SELECT COUNT(*) AS COUNT_ADVISE_INDEX FROM DB2INST.ADVISE_INDEX SELECT COUNT(*) AS COUNT_ADVISE_WORKLOAD FROM DB2INST.ADVISE_WORKLOAD
This function will let you resize an image in C#.
public static Bitmap Resize(Bitmap original,
int width, int height)
{
Bitmap bitmap = new Bitmap(width, height);
using (Graphics gfx = Graphics.FromImage(bitmap))
{
gfx.InterpolationMode
= Drawing2D.InterpolationMode.HighQualityBicubic;
gfx.SmoothingMode
= Drawing2D.SmoothingMode.HighQuality;
gfx.PixelOffsetMode
= Drawing2D.PixelOffsetMode.HighQuality;
gfx.CompositingQuality
= Drawing2D.CompositingQuality.HighQuality;
gfx.DrawImage(original, 0, 0, width, height);
return bitmap;
}
}
After weeks of putting up with significant disk activity and system slowness, I finally noticed that the McAfee anti-virus On Access Scanner process – mcshield.exe – was running as a High Priority process in Task Manager.
The fix was simple:
Happy system. Happy me.
I needed to get a list of all stored procedures that accessed a specific column in a table. Some stored procedures generated dynamic SQL statements so the View Dependencies feature was not guaranteed to get me the full list.
This query lets me retrieve the name and body of all stored procedures in a database. Adding the filter to look for the specific column is relatively simple.
SELECT o.Name AS SpName, c.Text AS SpBody FROM syscomments c WITH (NOLOCK) JOIN sysobjects o WITH (NOLOCK) ON c.ID = o.ID AND o.Type = 'P' -- Only stored procedures ORDER BY o.Name
This query is for SQL Server 2005 but should work across all versions.