Skip to main content

Posts

Showing posts from 2010

Howto run ASP on the Mac

I have an old web app that's using Active Server Pages, and I want to run it on my (Intel) Mac. This is basically not a big deal, because you can simply use Microsoft IIS under Parallels. But I wanted to use IIS only for ASP files, and let Apache handle the rest. And here's how to make sure IIS only handles what it's supposed to: To accomplish full ASP support on your Mac, read more on Ozar.net Dev Blog ...

Valid styles for converting datetime to string

I wrote this little table and procedure to help me remember what style 104 did, or how to get HH:MM AM/PM out of a DATETIME column. Basically, it populates a table with the valid style numbers, then loops through those, and produces the result (and the syntax for producing that result) for each style, given the current date and time. It uses also a cursor. This is designed to be a helper function, not something you would use as part of a production environment, so I don't think the performance implications should be a big concern. Read more »

Handle Null Date values in Microsoft SQL Server

In an SQL Server View, a problem is that the DateTime field has many NULL values which is causing a problem with the parsing of the data in MSAccess. How to I use CAST (or CONVERT) to handle Null Date values in my SQL Server view? There is a way to use CAST or CONVERT similar to the nz type function in MSAccess to handle null date values but I can't remember the syntax. What is happening now is that I get a data mismatch in my MSAccess function when it hits a Null Date value. Can I somehow use the ISNULL or ISDate function? I believe I need to somehow return "" instead of Null. Read more »

SQL SELECT INTO Statement

The SQL SELECT INTO statement can be used to create backup copies of tables. The SQL SELECT INTO Statement The SELECT INTO statement selects data from one table, creates a new table with the exact structure and size and inserts automatically the selected data into the new table. SQL SELECT INTO Syntax We can select all columns into the new table: SELECT * INTO new_table_name [IN externaldatabase] FROM old_tablename Or we can select only the columns we want into the new table: SELECT column_name(s) INTO new_table_name [IN externaldatabase] FROM old_tablename SQL SELECT INTO Example Make a Backup Copy - Now we want to make an exact copy of the data in our "Persons" table. We use the following SQL statement: SELECT * INTO Persons_Backup FROM Persons We can also use the IN clause to copy the table into another database: SELECT * INTO Persons_Backup IN 'Backup.mdb' FROM Persons We can also copy only a few fields into the new table: