July 31, 2000

Computed Values in Select Query

Question: Can I use computed values from a select list in a WHERE clause? For example: select age + 10 as AGE_10 from employee where AGE_10 > 50 Answer: This can be accomplished but not by using the calculated value in the WHERE clause. Instead, you’ll have to put the

Converting Text to Date for Aging Amounts

Question: The table I am using stores date values as strings due to conversion data. The format is 2000-07-01 for July 1, 2000. I need to be able to age amounts for an accounting report at any time, such as 0-30, 30-60, etc. Normally, I would just use a statement

Union Query

Question: I am writing a SQL statement in Access that is a union query. I am getting an error saying “The number of columns in the two selected tables or queries of a union query do not match.” I put NULL’s in there to see if it would work, but

Deleting a Column

Question: How do I delete a column, and all the values in it? Truncating will delete only the values, not the column itself. And I don’t want to drop the whole table. Answer: Thanks to Jose Muller for pointing out the right answer… SQL Server 7 supports dropping a column

Inserting Different Types of Objects in STL Lists

Question: I need a container of different objects. I have made all derived classes of the same base class and pushed them onto the container. The problem then arises in getting them off the container,i.e., base class synObject, and synPin and synPin derived: class synObject { public : synObject(); string

SQL Command to Retrieve Date

Question: What is the SQL command for retrieving the current date? Answer: The GETDATE() function returns the current date and time. Write it like this: SELECT GETDATE() AS CurrentDateCurrentDate ————————— 2000-07-25 16:54:25.293