Aqua Data Studio 7.0 Released

Posted By : todd sharp Posted At : October 15, 2008 8:32 PM Posted In: SQL, Apache Derby

0

I just got an email from AquaFold announcing the final release of version 7.0 of their popular Database query tool Aqua Data Studio. I've used ADS for a while on and off (thanks to a program that offers free licenses to Open Source developers) and I have to say it is a pretty good application.

Here is a list of features for 7.0 - which includes full support for Apache Derby databases.

Download Page

MySQL Error Code 17?

Posted By : todd sharp Posted At : May 21, 2008 3:40 PM Posted In: SQL

6

I don't usually like to post asking for help, but over the last few weeks I've seen some variation of the following error on my server:

Can't create/write to file '#sql_5c90_0.MYD' (Errcode: 17)

The file name is usually different, but the Errcode (17) is always the same. A quick google search shows that MySQL error code 17 means that the file exists (so it can't be overwritten), but nothing I've found tells me a.) what the heck the file is or b.) why it already exists or c.) how to make sure it doesn't exist the next time the process tries to write to it.

Any MySQL gurus out there have an idea? If I do the good old 'reboot' the problem goes away (for a few days/hours anyways).

SlideSix Preso Of The Day

Posted By : todd sharp Posted At : May 15, 2008 11:33 AM Posted In: SQL, SlideSix

0

Are you tired of me blogging about SlideSix yet? Today's preso of the day comes from my buddy Robert Froehling (Fro). Fro did a quick preso about SQL String Concatentation to the DFW CFUG a few days ago and has posted the preso up to the site. Thanks to his co-operation I did some more tweaks to the conversion engine, and this preso is the best looking yet (I think only one slide came in a bit weird where the bullet points were all concatenated to one line). Notice the heavy use of colored/commented code in his preso that used to come in with each formatted bit on it's own line. Thanks again Fro!

See more at slidesix.com

(Yes, it is the *only* preso of the day so far, but who's counting)...

MySQL UDF Repository

Posted By : todd sharp Posted At : March 20, 2008 12:23 PM Posted In: SQL

1

Just found a MySQL UDF Repository with a few nice libraries. Not quite what I'm looking for, but thought I'd blog it anyways.

Anyone know of a good library for MySQL date UDFs? I have to admit SQL Server seems to have a much larger community for things like UDFs.

TSQL - UDF To Round In Increments

Posted By : todd sharp Posted At : July 5, 2007 11:25 AM Posted In: SQL

4

After searching Google for a bit with no luck I decided to whip together a quick TSQL UDF to round values in incremements. Use cases are rather common so I'm surprised I couldn't find anything.

Quick Tip O The Day

Posted By : todd sharp Posted At : April 12, 2007 1:28 PM Posted In: SQL

5

I found this in a blog comment about a month ago - though I can't remember where and I'm not 100% sure someone didn't actually post it too - nonetheless - check out http://www.sqlinform.com/. It is a very cool utility for "prettying up" your SQL. There are some config options too (tabs or spaces for indent, etc). Basically it's a good way to make sense of nasty looking queries.

SQL Server Date Sorting

Posted By : todd sharp Posted At : March 28, 2007 11:39 AM Posted In: SQL, ColdFusion

5

Just had a quick issue that was driving me a bit nuts. I have a function that inserts site stats into a table. I was querying the table in Query Analyzer and was wondering why SQL server was incorrectly sorting my results. My query looked something like this:

select top 10 foo, dateAdded
from tbl
order by dateAdded desc

Which I fully expected to give me the 10 most recent records. In fact it was working fine before lunch today. Well after lunch it started getting weird on me. It was returning noon, then 11 am, then 10 am and then 1 pm! What? 1pm should be first! I took another look at my insert query and found this:

<cfqueryparam value="#dateformat(now(), "mm/dd/yy")# #timeformat(now(), "hh:mm")#" cfsqltype="cf_sql_timestamp">

Aha! In my timeformat() I was using the 12 hour clock. SQL server wants the 24 hour clock!

So a quick change to this (note HH):

<cfqueryparam value="#dateformat(now(), "mm/dd/yy")# #timeformat(now(), "HH:mm")#" cfsqltype="cf_sql_timestamp">

And the sorting was back to normal.

Update: Of cource I could have also just passed now() like so:

<cfqueryparam value="#now()#" cfsqltype="cf_sql_timestamp">

TSQL - Deleting Duplicate Rows From A Table

Posted By : todd sharp Posted At : March 19, 2007 10:58 AM Posted In: SQL

8

Here's a quick and dirty method for deleting duplicate rows from a table without an identity column. I know there are many versions of this query available via Google but I'm being selfish and blogging it so I always know where to find it. Thanks Chad!

--add identity row to table
ALTER TABLE myTable add rowid int identity(1,1)

---Delete Dups From myTable
delete from myTable
where rowid not in
    (select min(rowid)
    from myTable
    group by something)

--remove identity row from table
ALTER TABLE myTable DROP COLUMN rowid

TSQL - Last Day Of Month UDF

Posted By : todd sharp Posted At : March 14, 2007 12:04 PM Posted In: SQL

2

Here's a UDF I threw together to determine the last day of a given month.

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE function lastDayOfMonth(@d datetime )
returns datetime
as
BEGIN
return dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,@d)+1, 0))
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

So:

print dbo.lastDayOfMonth(getDate())
--returns Mar 31 2007 11:59PM

TSQL - Don't Forget sp_help!

Posted By : todd sharp Posted At : February 22, 2007 11:37 AM Posted In: SQL

3

Such a simple thing, but since I always forget that this little beauty exists I thought I'd blog for anyone who also forgets (or doesn't know about) sp_help. Check the docs for specifics, but essentially sp_help will give you metadata about an object (table, UDF, etc). Column names, datatypes, etc. Quick and dirty, just the way I like it.