SQL

Message Bookmarked
Bookmark Removed
I will, apparently, be learning it. What is it good for and what can I expect?

adam... (nordicskilla), Friday, 5 November 2004 20:07 (twenty-one years ago)

It's good for querying a database. You can expect to forget that you should be using 'is null'.

Mr Noodles (Mr Noodles), Friday, 5 November 2004 20:10 (twenty-one years ago)

What is it good for
selecting stuff from places where things are like %other things.

dave225 (Dave225), Friday, 5 November 2004 20:10 (twenty-one years ago)

bother things? mother things? what what what?

Mr Noodles (Mr Noodles), Friday, 5 November 2004 20:11 (twenty-one years ago)

you can teach it to me! I don't understand it, or databases, or jack shit

kyle (akmonday), Friday, 5 November 2004 20:28 (twenty-one years ago)

Can I break ILX with it?

adam... (nordicskilla), Friday, 5 November 2004 20:30 (twenty-one years ago)

Only if you already know a lot about the ILX backend. (Basically, no.)

Girolamo Savonarola, Friday, 5 November 2004 20:31 (twenty-one years ago)

Is the backend where everybody hooks up in secret?

adam... (nordicskilla), Friday, 5 November 2004 20:32 (twenty-one years ago)

SELECT putting a motherfucking semicolon at line's end FROM stupid shit that the Oracle SQL interface makes you do for no real reason SORT BY sheer hatred;

adam (adam), Friday, 5 November 2004 20:35 (twenty-one years ago)

Sorry, I just went NUTS.

adam... (nordicskilla), Friday, 5 November 2004 20:36 (twenty-one years ago)

there is no stupid shit and there is almost always a reason.

Mr Noodles (Mr Noodles), Friday, 5 November 2004 20:37 (twenty-one years ago)

Will I turn weird?

adam... (nordicskilla), Friday, 5 November 2004 20:37 (twenty-one years ago)

yes

kyle (akmonday), Friday, 5 November 2004 20:38 (twenty-one years ago)

"turn"

Dan Quisenberry (deangulberry), Friday, 5 November 2004 20:39 (twenty-one years ago)

:)

Dan Quisenberry (deangulberry), Friday, 5 November 2004 20:39 (twenty-one years ago)

Perhaps. Just learn to love todate and tochar and save yourself alot of pain. NVL and Decode can also save you lots of time.

Mr Noodles (Mr Noodles), Friday, 5 November 2004 20:39 (twenty-one years ago)

I don't know databases from a hole in the ground, but I think I'd better learn SQL too if I want to get some good tech writing jobs... My level of fear of math-like things is such that I once claimed I couldn't use Excel because I was Amish.

Layna Andersen (Layna Andersen), Friday, 5 November 2004 20:41 (twenty-one years ago)

SELECT annoying, just-different-enough-for-you-to-forget syntax for each bloody statement.

(why do INSERT and UPDATE have to be so different to each other, anyway?)

caitlin (caitlin), Friday, 5 November 2004 21:09 (twenty-one years ago)

expect annoyance and confusion at the outset, but a unique thrill when you write your first gargantuan SELECT query that works perfectly.

fortunate hazel (f. hazel), Friday, 5 November 2004 21:12 (twenty-one years ago)

if exists (select * from sysobjects where id = object_id('dbo.St_R334b') and sysstat & 0xf = 4)
drop procedure dbo.St_R334b
GO

CREATE PROCEDURE St_R334b
@Region varchar(12),
@fYear char(4),
@fMonthStart char(2),
@fMonthEnd char(2)
AS
BEGIN

DECLARE @Months int
DECLARE @TotalRev float

SELECT @Months = convert(int,@fMonthEnd) - convert(int,@fMonthStart) + 1

SELECT @TotalRev = Sum(t.MON_REV_C)
FROM tdrs_data AS t
WHERE t.fYear=@fYear AND (t.fMonth BETWEEN @fMonthStart AND @fMonthEnd)

SELECT c.CorporateID, c.CorporateName, c.Region,
Sum(t.MON_REV_C) AS mon_rev_c_sum,
Sum(t.MON_REV_C)/@TotalRev AS mon_rev_pct_of_ttl,
Sum(t.MON_REV_P) AS mon_rev_p_sum,
Sum(t.MON_PAX_C) AS mon_pax_c_sum,
Sum(t.MON_PAX_P) AS mon_pax_p_sum,
rev_class =
CASE
WHEN ((Sum(t.MON_REV_C)/@Months) * 12) > 3000000 THEN 1
WHEN ((Sum(t.MON_REV_C)/@Months) * 12) > 1000000 AND ((Sum(t.MON_REV_C)/@Months) * 12) 500000 AND ((Sum(t.MON_REV_C)/@Months) * 12) 100000 AND ((Sum(t.MON_REV_C)/@Months) * 12) 3000000 THEN 'Over $3 MM'
WHEN ((Sum(t.MON_REV_C)/@Months) * 12) > 1000000 AND ((Sum(t.MON_REV_C)/@Months) * 12) 500000 AND ((Sum(t.MON_REV_C)/@Months) * 12) 100000 AND ((Sum(t.MON_REV_C)/@Months) * 12)

57 7th (calstars), Friday, 5 November 2004 21:17 (twenty-one years ago)

*shudder*

caitlin (caitlin), Friday, 5 November 2004 21:22 (twenty-one years ago)

See, I don't work w/ SQL like that. I am happy for that, too. Though I will undoubtedly not make a damn bit of coin until I muck around in that sort of shit.

David R. (popshots75`), Friday, 5 November 2004 21:25 (twenty-one years ago)

programmers are weird. phpmyadmin for mysql still confuses me.

Kenan (kenan), Friday, 5 November 2004 21:27 (twenty-one years ago)

Luckily that crap was already in place when I got to my current job; I still have to go in and decipher it now and then though.

57 7th (calstars), Friday, 5 November 2004 21:32 (twenty-one years ago)

if i tell you i can make sense of that, will you give me a job?

fortunate hazel (f. hazel), Friday, 5 November 2004 21:35 (twenty-one years ago)

I hate every php-based database admin tool I've come across. I hate to admit it, but my favourite database admin program is probably MS SQL Server Enterprise Manager.

caitlin (caitlin), Friday, 5 November 2004 21:36 (twenty-one years ago)

SQL is a bit of an anomaly in computing, in that it's the most common standard for accessing data, but has largely been a failure. The idea is you declaratively tell the computer what data you want and it figures out the best way to get it. Things haven't panned out that way in the 30 years or so of its life.

Keith Watson (kmw), Friday, 5 November 2004 21:41 (twenty-one years ago)

I've always thought that SQL was easy to learn, but very difficult to master.

57 7th (calstars), Friday, 5 November 2004 21:42 (twenty-one years ago)

Just like bass guitar!

Keith Watson (kmw), Friday, 5 November 2004 21:42 (twenty-one years ago)

The difficult part is in understanding how the database will react to queries you give it. It's not just the SQL that counts here either, indexing, network round-trips, how data is aggregated, available memory on boxes and so on all play a part.

Keith Watson (kmw), Friday, 5 November 2004 21:44 (twenty-one years ago)

there is no stupid shit and there is almost always a reason.

What's the reason for using a sub-DOS CLI in 2004? Not that I mind using a command line--but why can't it act more like BASH? My problems are really more with Oracle than with SQL.

adam (adam), Friday, 5 November 2004 21:51 (twenty-one years ago)

Why don't you download cygwin Bash for your PC?

http://www.cygwin.com/

Keith Watson (kmw), Friday, 5 November 2004 21:52 (twenty-one years ago)

Oh god what strange world I am entering?

adam... (nordicskilla), Friday, 5 November 2004 21:55 (twenty-one years ago)

Be scared...
No really. Be scared.

57 7th (calstars), Friday, 5 November 2004 22:02 (twenty-one years ago)

I just kinda took a crash course in it (well mySQL actually). You can expect to eventually find this joke funny:

What is it good for
selecting stuff from places where things are like %other things.
-- dave225 (right.knewi...), November 5th, 2004 2:10 PM. (Dave225) (later) (link)


--------------------------------------------------------------------------------

bother things? mother things? what what what?
-- Mr Noodles (infinitecow...), November 5th, 2004 2:11 PM. (Mr Noodles) (later) (link)

teeny (teeny), Friday, 5 November 2004 22:02 (twenty-one years ago)

Are you Lil Jon?

xpost

adam... (nordicskilla), Friday, 5 November 2004 22:03 (twenty-one years ago)

Best SQL line I saw recently started 'where what like'.

Martin Skidmore (Martin Skidmore), Friday, 5 November 2004 22:05 (twenty-one years ago)

Oh, I'm sure I'll have a few real gems just like that to share with you all soon! What fun we'll have!

*RUNS AWAY*

adam... (nordicskilla), Friday, 5 November 2004 22:06 (twenty-one years ago)

what kind of job did you inherit? I thought you'd just have to use a front-end thing. are you a db admin now????

kyle (akmonday), Friday, 5 November 2004 22:09 (twenty-one years ago)

Yes!

adam... (nordicskilla), Friday, 5 November 2004 22:10 (twenty-one years ago)

All of our regional people come to ME for HELP!!!

adam... (nordicskilla), Friday, 5 November 2004 22:10 (twenty-one years ago)

have fun

kyle (akmonday), Friday, 5 November 2004 22:12 (twenty-one years ago)

are the "regional people" like "provincals"?

kyle (akmonday), Friday, 5 November 2004 22:12 (twenty-one years ago)

Something like that, yeah. Dumbasses.

adam... (nordicskilla), Friday, 5 November 2004 22:12 (twenty-one years ago)

"hicks"

Kenan (kenan), Friday, 5 November 2004 22:13 (twenty-one years ago)

Hope that your workplace uses only one flavor of DB. We use Oracle and mysql and I continually forget that, say, mysql can't do an update on certain types of joins. Grrrr.

SQL joins are one of the things that are a pain in the ass to learn to master, but once you can do them and understand why you'd want an inner join vs an outer join, you will be happy. And a huge geek.

fairly good joins 101: http://www.onjava.com/pub/a/onjava/2004/01/07/SQLJoins.html

lyra (lyra), Saturday, 6 November 2004 04:35 (twenty-one years ago)

Oh God, this takes me back - I was writing queries back in Oracle v4 on an IBM mainframe, y'know (my inability to get beyond v7.3 into the OO world pretty much ended my career in software development). I never mastered PL/SQL, but felt a bit more comfortable with ProPascal and ProFortran.

Thank goodness I don't have to worry about this stuff any more.

Michael Jones (MichaelJ), Saturday, 6 November 2004 15:05 (twenty-one years ago)

but Michael, the alleged OO parts of Oracle 8 and 9 are rubbish, and I can't imagine many places use them - I work in an Oracle house, and no one there uses them at all. I like OO much better than the old style, but I wouldn't use the half-arsed Oracle version if I could avoid it.

Martin Skidmore (Martin Skidmore), Saturday, 6 November 2004 17:10 (twenty-one years ago)

I agree... OO simply doesn't fit with relational databases. The "OO" features are purely a marketing gimmic. Pre-relational databases fit better with OO (and obviously OO databases). It's a bit like the XML features they're all currently bolting on to databases.

Keith Watson (kmw), Saturday, 6 November 2004 18:16 (twenty-one years ago)

Yeah, the two are too different to fit together. I remember a lecturer at uni said that 'OO database' was an oxymoron, and he's right - the whole idea of separating off the data is contrary to the fundamental ideas of OO. The first version Oracle released with 'object-relational' features didn't even have inheritance implemented!

Martin Skidmore (Martin Skidmore), Saturday, 6 November 2004 20:13 (twenty-one years ago)

programmers are weird. phpmyadmin for mysql still confuses me.

Programmers make things different and sometimes just a little bit too complicated on purpose for job security.

Placebo Effect, Saturday, 6 November 2004 20:16 (twenty-one years ago)

Or through incompetent or mad design. A couple of years ago a colleague had to move the student fee system onto new technology. He was struggling with the invoicing process, and I was asked to help. He explained the process, which hadn't been documented, and it had taken him a week's work to even fathom out these components:

1. The user puts a P against a record for which they want an invoice to be printed.
2. A Unix shell script runs (ending by calling itself to run 30 seconds later), which invokes...
3. A database procedure, which looks through all the records, searching for a P. When it finds one, it spools...
4. Another Unix shell script.
5. The script from step 2 moves the one from step 4, changes its permissions, and tidies it up with...
6. A small sed script.
7. The step 2 script then runs that from step 4, which calls...
8. One of 8 or 9 (I can't remember) Report Writer reports, which generates...
9. An output file.
10. Much as 5 - the step 2 script moves this, changes its permissions, and runs...
11. Another small sed script.
12. Finally, the resultant file is sent to the printer, and
13. The user sees an invoice appear on their printer.
14. Well, one more step: all the intermediate files are deleted by the one in step 2. This obviously made tracking problems and errors incredibly difficult.

This developer was frantic with worry: he couldn't imagine how he was going to convert this. I told him that we shouldn't try to do anything of the sort: that the only steps that mattered were 1 and 13. I developed a single report with flexible enough formatting to handle the differences between the 8 or 9 previous ones, and when the user committed that P in step 1, that triggered a call to this report, the output for which went directly to the printer. It took me less time to develop this than it had taken him to even understand the old method. The users commented on two differences: the new invoice looked slicker and more attractive, and it appeared much more quickly. The developer was delighted that he had something orders of magnitude easier to support. That's the kind of bad design systems sometimes end up with, until someone who likes simplicity and clarity gets at them.

Martin Skidmore (Martin Skidmore), Saturday, 6 November 2004 20:41 (twenty-one years ago)

I've had it explained to me many different times, but never in a way that I can truly understand - In lay terms, what exactly is object oriented programming?

Girolamo Savonarola, Saturday, 6 November 2004 21:33 (twenty-one years ago)

Basically, your program is separated out into small chunks, each of which contains some data, and the code to process and handle that data.

caitlin (caitlin), Saturday, 6 November 2004 21:39 (twenty-one years ago)

Well yes: the point is that it abandons the idea of separating data from process, and encapsulates them together in an object, with attributes (data) and methods (code). It always made great sense to me, and I really liked working in it, though I haven't done any for years.

Martin Skidmore (Martin Skidmore), Saturday, 6 November 2004 21:59 (twenty-one years ago)

But...but...aren't programs already essentially written in modular chunks? Isn't that essentially what functions are for? What am I missing here?

Girolamo Savonarola, Saturday, 6 November 2004 22:18 (twenty-one years ago)

Yes, but they don't encapsulate the data and the code in one object - the code is in scripts, the data in the database. OO puts them together - the modular chunk, the object, is the code AND data together.

Martin Skidmore (Martin Skidmore), Saturday, 6 November 2004 22:20 (twenty-one years ago)

So you don't need a database?

Girolamo Savonarola, Saturday, 6 November 2004 22:34 (twenty-one years ago)

Don't need and can't have a traditional database, that's right.

Martin Skidmore (Martin Skidmore), Saturday, 6 November 2004 23:50 (twenty-one years ago)

I can understand how that'd be good in constructing a executable program, but how can that be easier for web-based programs?

Girolamo Savonarola, Saturday, 6 November 2004 23:57 (twenty-one years ago)

I'm not saying that it is - I've not worked on such things, so I don't know. I don't think it would be a problem, though, and indeed Java is fundamentally OO, and it seems to have been quite successful on the web.

Martin Skidmore (Martin Skidmore), Sunday, 7 November 2004 00:15 (twenty-one years ago)

Post software engineering nightmares!

Spinning Down Alone You Spin Alive (ex machina), Sunday, 7 November 2004 01:01 (twenty-one years ago)

Y'know - it's funny, I always suspected object-oriented design and relational databases didn't really go together (based on no great deep knowledge of either - I mean I was a confused C++ programmer for about a fortnight and a bad Oracle developer either side of that).

The hump from v7 to v8 looked like a big one and I certainly seemed to miss my opportunity to train on the job with companies who were migrating from one version to the other by not bailing out of the pharma sector when I had the chance in summer/autumn 2000.

By the time I was in the job market a year later I was out of luck (general lack of interest in programming as a discipline meant I never kept abreast of new developments or tried to improve my skills, so if I didn't encounter something in a wage-earning environment or on a course I'd been sent on I wouldn't know it).

Michael Jones (MichaelJ), Sunday, 7 November 2004 01:14 (twenty-one years ago)

Eh?
I write OO code that runs a database backed website. I don't see why they don't work together. My code is what's OO, and the databases are databases, and the code just gets what it needs from the DB through a nice interface that we wrote.

lyra (lyra), Sunday, 7 November 2004 03:07 (twenty-one years ago)

How do they work together?

Girolamo Savonarola, Sunday, 7 November 2004 11:12 (twenty-one years ago)

There's some rather odd stuff about OO and databases on this thread. OO is not an all or nothing philosophy, you can have programs that are 90% OO, 50% OO or even 10% OO. The methodology used should fit the subtask. So usiing a RDBMS for storing data which is then loaded into objects and manipulated in the program is perfectly reasonable. What *is* silly is having an RDBMS with a load of 'OO facilities' glommed onto the relational system, particularly when using SQL. SQL is primarily a declarative set manipulation language, and using it for anything other than that is a recipe for shitty code and nasty headaches.

RickyT (RickyT), Sunday, 7 November 2004 13:00 (twenty-one years ago)

I was trying to explain OO, I didn't mean to suggest they couldn't work together - of course they can and do. Using both often means you end up with a non-OO design, which fails to make the most, or even much, of the advantages of OO. It's a halfway approach that usually involves a fundamentally traditional design with some OO stuff on top. Pure OO doesn't need or use databases - but obviously there is no rule enforcing purity in design or coding. I've no idea how common a pure OO approach is.

Martin Skidmore (Martin Skidmore), Sunday, 7 November 2004 23:00 (twenty-one years ago)

Not at all common in my experience. I wouldn't say that it doesn't need databases; surely you have to persist information somehow?

I think the difference is that in an OO program, persisting your information in a relational database requires that you write code to make it write to tables in the database (either that or use something like Hibernate or TopLink to do it for you). This isn't theoretically required, since the classes contain enough information to know how to persist themselves without any additional code; this is how OO databases work.

This sounds simple, but then you have to be very careful how you use the objects, since you may wind up accidentally firing off thousands of unexpected round-trips across the network to a database. I've never understood how taking a "pure" OO approach can work in a large production system without *considerable* additional complexity, i.e. complicated caching mechanisms and mechanisms to handle lost updates etc. This is not to say I'm not in favour of OO; I am; no better way to go about writing programs, but when it comes to persistence, you have to compromise in order that things perform.

Keith Watson (kmw), Sunday, 7 November 2004 23:09 (twenty-one years ago)

This sounds simple, but then you have to be very careful how you use the objects, since you may wind up accidentally firing off thousands of unexpected round-trips across the network to a database.

At work recently, my boss asked me to test out the latest version of an application we're using. "It's supposed to be more efficient when working across a wide-area network like we're doing," he said.

When I asked what was so bad about the current version that could be improved - well. This app shows tables of data on-screen quite a lot. It turns out that for each view it displays, version 1 uses an individual SELECT statement for every single cell in the table on-screen. The new version is much more efficient, because they've cut it down to one SELECT per row.

caitlin (caitlin), Sunday, 7 November 2004 23:14 (twenty-one years ago)

Sounds like a case in point.

A stored procedure to get all the rows sounds like a better solution, unless of course the query to one row depends on the results from the previous query.

You can get around these problems, but you have to program lots of smarts into the classes and guess about how the client program is going to use to objects, i.e. load tons of objects up at once if you think someone's going to loop across them. Then you've got the problem of making sure if someone's going to update something that someone else hasn't updated it in the background.

In addition to this, when you guess about how people will use your program, typically you get it wrong.

Keith Watson (kmw), Sunday, 7 November 2004 23:18 (twenty-one years ago)

Keef is on fire here - like Townshend on "Bargain".

Michael Jones (MichaelJ), Monday, 8 November 2004 08:17 (twenty-one years ago)

one day i will understand this thread, one day...

CarsmileSteve (CarsmileSteve), Monday, 8 November 2004 13:38 (twenty-one years ago)

I thought you were all about the databases, Mr Carsmile?

RickyT (RickyT), Monday, 8 November 2004 13:39 (twenty-one years ago)

aha, just because i have the phrase "database administrator" in my job title doesn't make me a DBA...

...i can piss about in access quite well, but that's about it, our student database runs on "advantage database" which uses some sort of, um, delphi thingummy...

CarsmileSteve (CarsmileSteve), Monday, 8 November 2004 13:43 (twenty-one years ago)

Steady, Mike! I'm just warming up! Like Townshend in the '60s.

Keith Watson (kmw), Monday, 8 November 2004 18:46 (twenty-one years ago)

my god this is boring

adam... (nordicskilla), Thursday, 18 November 2004 16:47 (twenty-one years ago)

DECODE ('boring', 'GREBTEST TING EVAH!')

Mr Noodles (Mr Noodles), Thursday, 18 November 2004 16:50 (twenty-one years ago)

I have to admit I still giggle over the mother things/bother things joke.

teeny (teeny), Thursday, 18 November 2004 16:52 (twenty-one years ago)

seven months pass...
What is this the closest we have to a dedicated Oracle thread? But who will explain Scott and Tiger to me? Sigh.

Yesterday, I realised that in order to make all my lovely pretty new reports in Crystal Reports floating over Pivotal, I would have to figure out how the old reports were done. So I cracked the lid and stared into the Heart Of Darkness that is our current Oracle database.

I've read Oracle 8 for Dummies, but it hasn't really told me much about anything I didn't really know already (don't ever use an Intelligent Primary Key, like, duh) about database in general rather than Oracle in specific.

I've figured out what TOAD is. It's my schema browser and SQL compiler thingeygummy. And I'm wrestling with Crystal - both its reports bit and its clumbsy SQL generator.

A View is not what I thought it was - it's more like a permanent query. And Procedures and Packages are a bit like massive Macros. And inner/outer left/right Joins are like all the different one to many/one to on Relationships. But what's a Synonym?

And when am I ever going to get my own DBA login? And my own email? And that laptop they promised me...

MIS Information (kate), Thursday, 23 June 2005 10:56 (twenty years ago)

I thought I was all, like, Ms. Thang when it came to databases, but two days of Oracle has made me realise how little I really know...

MIS Information (kate), Thursday, 23 June 2005 11:02 (twenty years ago)

As I understand it, a View behaves like a table wrt SELECT queries, but doesn't actually store any data; it's just defined in terms of a SELECT query itself. What did you think it was?

I'm sure that MSSQL also has all that inner/outer and left/right join gubbins.

Tech Support Droid, Thursday, 23 June 2005 11:17 (twenty years ago)

Not in Access, it doesn't! Anyway, I've been working in ACT which doesn't even have JOIN at all, because everything is in the same bloody table...

In my world, a View is more like a GUI thing - whether you're looking at the front end (the GUI input form) or the back end (data sheet/design mode). So I guess an Oracle View behaves like a table, but is really built like a Query. I don't even *know* how to get at the GUI bits of this database. (Well, OK, I do, through a DOS promt, that's how old and shite it is.) Because all I'm doing is the report managing.

MIS Information (kate), Thursday, 23 June 2005 11:20 (twenty years ago)

i don't use Oracle and TOAD but the two guys sitting opposite me are DBA's and all i hear all day is this type of stuff. I'm glad they're both off today

Ste (Fuzzy), Thursday, 23 June 2005 11:30 (twenty years ago)

The main reason I know MS SQL Server has all that join functionality is that I once peeked at some of the stored procedures in the database one of our applications uses; and was horrified at what I saw. I don't understand joins (even though most of my DB knowledge comes from using PostgreSQL, which definitely has them too).

We have someone here who's a fan of ACT - assuming the ACT I'm thinking of is the same one you are - but we're trying to wean him away from it.

(this where a Sheepfux0r pops up and says "I didn't know Kate was working in Canberra, ho ho ho")

Tech Support Droid, Thursday, 23 June 2005 11:35 (twenty years ago)

i was considering trying to learn SQL. this thread has put me off. hurrah!

grimly fiendish (grimlord), Thursday, 23 June 2005 11:39 (twenty years ago)

I understand joins, I'm just confused because of the different language used to describe them! It's like I'm trying to program a query in Chinese!

I hate ACT. I hate it so much. It's not a database, it's an old rusty bucket. Yuck.

I'm just confused as heck by these Views. So, basically a View is a permanent query that you can do stuff with, which is two or more tables bashed together (by joins). Except one of the Joins has gone horribly wrong - it was supposed to be one to many, but it's become many to many, meaning I have double records in my report! Wrong, wrong, wrong! I thought the Crystal SQL was doing it, but it's actually in TOAD as well.

MIS Information (kate), Thursday, 23 June 2005 11:43 (twenty years ago)

(Could it really be so simple as someone using "UNION ALL" instead of "UNION"?)

MIS Information (kate), Thursday, 23 June 2005 11:47 (twenty years ago)

http://www.billybragg.co.uk/images/biography/billy_bragg_solo.jpg

there is power in a UNION

Ed (dali), Thursday, 23 June 2005 11:57 (twenty years ago)

It wasn't anything to do with the UNION. It wasn't even a programming error... it was a bloody DATA ENTRY error! Some idiot broker entered the same mortgage type twice. Argh.

MIS Information (kate), Thursday, 23 June 2005 12:17 (twenty years ago)

does Billy Bragg do any songs about the power of DISTINCT? 8)

koogs (koogs), Thursday, 23 June 2005 12:50 (twenty years ago)

I think he did one on left join.

Rufus 3000 (Mr Noodles), Thursday, 23 June 2005 12:55 (twenty years ago)

I hate the Oracle DATE thing already. :-(

MIS Information (kate), Thursday, 23 June 2005 13:30 (twenty years ago)

Just wait till it turns into a love/hate relationship.

Rufus 3000 (Mr Noodles), Thursday, 23 June 2005 14:02 (twenty years ago)

Not all DATEs turn into that!

mark grout (mark grout), Thursday, 23 June 2005 14:06 (twenty years ago)

First DATE I've had in 6 months so I'm not complaining. Wait, actually, I am. I just signed an Email in SQL. I'm losing my mind.

MIS Information (kate), Thursday, 23 June 2005 14:09 (twenty years ago)

how does that work?

mark grout (mark grout), Thursday, 23 June 2005 14:10 (twenty years ago)

How does what work? I'm not going to vent my geek humour here because someone will start debugging my joke code. Sigh.

MIS Information (kate), Thursday, 23 June 2005 14:17 (twenty years ago)

I am going to have another cup of free coffee (trying Chocolate Espresso this time) from the coffee server before I tackle this thing:

CREATE OR REPLACE PACKAGE BODY Production_Report_Pkg IS

MIS Information (kate), Thursday, 23 June 2005 14:26 (twenty years ago)

Chocolate Espresso? I feel ill already...

mark grout (mark grout), Thursday, 23 June 2005 14:30 (twenty years ago)

I don't know what it was, but it was GRATE!!! I love the coffee server. It was broken the first few days I was here. That was like chocolate flavoured Turkish Coffee. I want another, but I suspect I would start humming. But that's the fun of programming, isn't it?

I told my boss that one of my web geek friends solved one of the worst ongoing problems and now no one seems to care if I'm on the interweb. (Thanks, Noodles!)

MIS Information (kate), Thursday, 23 June 2005 14:32 (twenty years ago)

What's the difference between the = and the *= ?

k/l (Ken L), Thursday, 23 June 2005 14:34 (twenty years ago)

Chocolate Turkish espresso? Makes you ill, then CURES you!

mark grout (mark grout), Thursday, 23 June 2005 14:38 (twenty years ago)

*= and =* are left outer and right outer joins. Wow, I actually knew that. I must be learning something!

MIS Information (kate), Thursday, 23 June 2005 14:39 (twenty years ago)

I still think they'd be impressed if you started giving them reports with the date in roman numerals.

Where's the (+) love?

Rufus 3000 (Mr Noodles), Thursday, 23 June 2005 14:54 (twenty years ago)

People all over the world (+) hands
Start a love train, love train

Rufus 3000 (Mr Noodles), Thursday, 23 June 2005 14:55 (twenty years ago)

You mean...

INSERT INTO love.train LT
SELECT people
FROM allover.world ALW
  WHERE ALW.hands *= LT.hand

(I'm sure I didn't do that right, where is my debugger to give me annoying messages.)

MIS Information (kate), Thursday, 23 June 2005 15:00 (twenty years ago)

Oh no, I left out the column names, that's why it makes no sense. Sigh.

MIS Information (kate), Thursday, 23 June 2005 15:02 (twenty years ago)


select ENGLAND cross join EGYPT cross join ISRAEL

ach, whatever.

mark grout (mark grout), Thursday, 23 June 2005 15:21 (twenty years ago)

GOD I hate SQL

a real bear behind the microphone (nordicskilla), Thursday, 23 June 2005 16:37 (twenty years ago)

It's just struck me that it's fairly odd, and at odds with the rest of the computing industry, that after 30 odd years, there's no significant alternative to SQL in that field.

KeefW (kmw), Thursday, 23 June 2005 16:41 (twenty years ago)

You could always put everything in an ASCII or binary file and then sort it beforehand or when you read it into memory and have some fast way of indexing in.

k/l (Ken L), Thursday, 23 June 2005 16:43 (twenty years ago)

But it probably sounds much sexier to say you are using a "relational database."

k/l (Ken L), Thursday, 23 June 2005 16:44 (twenty years ago)

There are alternative SQLs, though I know thats not what you mean..

Rufus 3000 (Mr Noodles), Thursday, 23 June 2005 16:44 (twenty years ago)

Yes, it's not... Almost everyone's got their alternative SQL!

k/l... Indeed... ISAM, VSAM, GSAM, QSAM etc. People often use relational databases when it's not fit for purpose.

KeefW (kmw), Thursday, 23 June 2005 16:47 (twenty years ago)

I'm going to go and get some proper training in 20 minutes. Woo-hoo. So finally I will know what I'm doing... maybe.

MIS Information (kate), Friday, 24 June 2005 07:41 (twenty years ago)

cue lots of "oh THAT's why..."

mark grout (mark grout), Friday, 24 June 2005 08:10 (twenty years ago)

I dunno about Oracle SQL, but in SQL Server SQL, you shouldn't use the *= or =* syntax, because it behaves strangely with nulls under certain conditions, you should always use the full left outer join/right outer join syntax.

That's my geek tip for the day! You're welcome.

Colonel Poo (Colonel Poo), Friday, 24 June 2005 09:16 (twenty years ago)

I'm not really here. I *can* surf the interweb from my training laptop, but I'm not going to. I'm finding out more about the banking industry and mortgages and ALL THOSE BLOODY ACRONYMS!!! than I ever wanted to know.

I never knew there was something more heavy on the acronyms than computing, but banking would be it.

Does anyone want a mortgage? I'm setting up new clients in the test database. ;-)

MIS Information (kate), Friday, 24 June 2005 09:36 (twenty years ago)

Argh, MS Query is teh suX0r. am I going to have to build my very own Oracle query from scratch?!?!?

MIS Information (kate), Monday, 27 June 2005 11:42 (twenty years ago)

Argh, I've only ever adapted existing things in Oracle. Should I create a Table or just a new View?

MIS Information (kate), Monday, 27 June 2005 11:44 (twenty years ago)

A view would be better.

mark grout (mark grout), Monday, 27 June 2005 11:52 (twenty years ago)

That depends on what you're doing!

If you're not going to be storing any new data, but are only trying to analyse data already stored in other tables, then a View is probably what you are looking for.

However, I am not an Oracle oracle.

(xpost)

Tech Support Droid, Monday, 27 June 2005 11:54 (twenty years ago)

i'M GOING WITH A VIEW.

Whoops, sorry, programming all caps on there.

I've got the info from one table in, filtered by date - now I have to join the other two tables. This is going to be hard with those crazy Oracle joins!

MIS Information (kate), Monday, 27 June 2005 11:56 (twenty years ago)

Argh, I have just discovered the whole point of (+) and why it is so great! Hurrah!

MIS Information (kate), Monday, 27 June 2005 13:26 (twenty years ago)

I have just discovered that the cause of all my problems wasn't that my SQL was wrong, but that the data I want isn't actually in the database. Bah.

I'm very proud. It's my first Oracle thing from scratch.

Sigh. No one cares. Even the bloke who asked for the report hasn't commented on it.

MIS Information (kate), Monday, 27 June 2005 14:57 (twenty years ago)

Aww. *We* care.

Tech Support Droid (ForestPines), Monday, 27 June 2005 15:38 (twenty years ago)

I don't!

kyle (akmonday), Monday, 27 June 2005 15:39 (twenty years ago)

My baby...

CREATE OR REPLACE VIEW V_JUNE05_PRODUCTS
( STATUS,
BSOC,
BSOC_SUB,
INT_DATE,
CE_NARR,
CE_NARREXT,
CASE_NUM,
CN_NARR,
CN_NARREXT )
AS SELECT
C.STATUS,
C.BSOC,
C.BSOC_SUB,
C.INT_DATE,
CE.NARR,
CE.NARR_EXTENDED,
C.CASE_NUM,
CN.CHQ_NARR,
CN.EXTRA_NARR
FROM CASES C, CODES_EXTENDED CE, CODES_NARR CN
WHERE C.INT_DATE >= '01-JUN-05'
AND C.BSOC = CE.MAIN_CD (+)
AND C.BSOC_SUB = CE.SUB_CD (+)
AND C.BSOC = CN.MAIN_CD (+)
AND C.BSOC_SUB = CN.SUB_CD (+)
AND CE.CLASS (+) = '1'

MIS Information (kate), Monday, 27 June 2005 15:42 (twenty years ago)

So what *does* the (+) do?

(I said I didn't know much about Oracle)

Tech Support Droid (ForestPines), Monday, 27 June 2005 15:49 (twenty years ago)

It basically makes it an outer join. (Is that the right word? What it does is return all the records in the first table, even if there are no matches in the one with the + on it.)

It's an Oracle foible that it took me ages to figure out.

MIS Information (kate), Monday, 27 June 2005 15:51 (twenty years ago)

Aaah. So your view consists of all the rows in the CASES table, with some of the columns pulled out out CODES_EXTENDED and CODES_NARR, but if there's a row in CASES that doesn't have a matching row in either of the other two it will still appear in the view, just with no data in the fields that come from the other tables? Is that right?

I think I get my head around that.

Tech Support Droid (ForestPines), Monday, 27 June 2005 15:56 (twenty years ago)

SQL is topp! Admittedly, I don't have to use it in anger, but as the backend for my little bulletin board thingy, what I can then fire queries at from Perl, it's utterly delish. I have no idea if it will scale, or if I've properly( er-what's-the-term) normalised(?) everything, but it hums along sweetly.

stet (stet), Monday, 27 June 2005 16:29 (twenty years ago)

My baby...

aw, it has your nose!

Ste (Fuzzy), Monday, 27 June 2005 16:34 (twenty years ago)

Yes, Droid, that's exactly it!

Today we have a Proper Oracle Person to explain what I've been doing wrong. Hurrah.

MIS Information (kate), Tuesday, 28 June 2005 06:35 (twenty years ago)

Kate,

http://www.bbc.co.uk/cgi-perl/whatson/prog_parse.cgi?FILENAME=20050629/20050629_1100_49700_1492_30

Ed (dali), Tuesday, 28 June 2005 06:46 (twenty years ago)

Kate: I read the PostgreSQL documentation about different sorts of join, and was tempted to rewrite your query with the whole TABLE1 LEFT OUTER JOIN TABLE2 syntax. Then I realised I had better things to do, like the washing-up.

Ed: I heard a trailer for that during Today this morning - it sounds rather interesting.

Tech Support Droid (ForestPines), Tuesday, 28 June 2005 06:51 (twenty years ago)

(the father of one of my exes was a Freemason, and had been Master of his lodge even; but his wife thought it was just an excuse for men to get drunk and refused to have anything to do with it. I was once tempted - for about five minutes - to do an anthropology project on the differing social backgrounds of Freemasons in Scotland and England, because as far as I can see in Scotland there is a much greater working-class element to Freemasonry)

Tech Support Droid (ForestPines), Tuesday, 28 June 2005 06:54 (twenty years ago)

Ah! Ah! I want to be a woman of the lodge!

Heh. My tech support guy is a dead ringer for Captain Picard. It's quite scary, actually!

MIS Information (kate), Tuesday, 28 June 2005 07:29 (twenty years ago)

I've written two more SQL views from scratch today, and I'm about to start work on a fiendishly difficult third!

man, I am *so* putting Oracle on my resume after this...

MIS Information (kate), Tuesday, 28 June 2005 12:04 (twenty years ago)

Yay!

Tech Support Droid (ForestPines), Tuesday, 28 June 2005 12:06 (twenty years ago)

two weeks pass...
I'm not even sure if this is a SQL problem or what, but here goes...

I'm having a lot of trouble getting my COUNT function to work.

See, what I want to do is not count the total number of records, or the discrete values - what I want to do is count the number of a *specific* value.

I have a Boolean field - I want a subtotal COUNT that counts the number of "FALSE" returns within a group.

How the heck do I do this? there's nothing either in my SQL dictionary or my Dummies book which explains it.

MIS Information (kate), Thursday, 14 July 2005 15:18 (twenty years ago)

Sub-queries.

Jon, remind me again why you haven't drowned in your own vomit (ex machina), Thursday, 14 July 2005 15:23 (twenty years ago)

Although, do you just want the query to return just this count or is it a "bag on the side" of a more complex query?

Jon, remind me again why you haven't drowned in your own vomit (ex machina), Thursday, 14 July 2005 15:25 (twenty years ago)

Actually, scratch that, it's not even a problem with the SQL, I can do that no problem - it's a problem with Crystal Reports. Argh. You can't specify a WHERE clause it seems.

MIS Information (kate), Thursday, 14 July 2005 15:26 (twenty years ago)

select count(*), field from table group by field

Rufus 3000 (Mr Noodles), Thursday, 14 July 2005 15:26 (twenty years ago)

Are you using the useless GUI for crystal?

Rufus 3000 (Mr Noodles), Thursday, 14 July 2005 15:27 (twenty years ago)

You can't specify a WHERE clause in CR?????? That doesn't sound right at all! Really??????

The Ghost of Dan Perry (Dan Perry), Thursday, 14 July 2005 15:28 (twenty years ago)

Why is this such a rubbish programme? What should be called a formula is called a function. But you can't stick a function in a report unless it's attached to a formula. WTF?

I'm using the useless GUI cause they won't give me access to anything else. :-(

MIS Information (kate), Thursday, 14 July 2005 15:28 (twenty years ago)

OK, what I want to do is this - for each record, there's a field with a Boolean true/false. In the Group Footer, I want to have a count of just the FALSE records.

How the heck do I do this?

MIS Information (kate), Thursday, 14 July 2005 15:30 (twenty years ago)

i'm no sql whiz, but rufus, tho art the man. i didn't know you could do that.

hmm... i would've assumed CR could do more. that's pretty ridiculous.
m.

msp (mspa), Thursday, 14 July 2005 15:33 (twenty years ago)

SELECT sum(if(field=false,1,0)) FROM etc etc

grraham (noodles is a cunt), Thursday, 14 July 2005 15:37 (twenty years ago)

alternatively:
SUM(DECODE(field, false, 1,0))

Rufus 3000 (Mr Noodles), Thursday, 14 July 2005 15:42 (twenty years ago)

I can't seem to attach an IF to a COUNT. I can't see to attach a WHERE to a COUNT.

The only things it will let me do are these:

Count (fld, condFld, cond)

where fld is the field, condFld is what you group it by, and cond another thing you group it by. (This is making no sense to me - it's like subtotal in Excel, telling the thing where to put the subtotals in.)

MIS Information (kate), Thursday, 14 July 2005 15:44 (twenty years ago)

Sounds more like SOL

Jon, remind me again why you haven't drowned in your own vomit (ex machina), Thursday, 14 July 2005 16:01 (twenty years ago)

Can you create a temporary field in crystal and total on that?

Rufus 3000 (Mr Noodles), Thursday, 14 July 2005 16:01 (twenty years ago)

I started a new thread:

Crystal Reports

I think I'm going to have to create a whole new query and a whole new subreport. Which seems insane for such a minor thing.

MIS Information (kate), Thursday, 14 July 2005 16:02 (twenty years ago)

if you do a count and group by the boolean field name you'd end up with two values, a count of the true values and a count of the false ones. just ignore the count for true. would that work?

koogs (koogs), Thursday, 14 July 2005 16:20 (twenty years ago)

I can't seem to attach an IF to a COUNT. I can't see to attach a WHERE to a COUNT.

use HAVING after the group statement.

e.g. HAVING COUNT(1) > 4

mark grout (mark grout), Friday, 15 July 2005 09:21 (twenty years ago)

Ah! That seems like it might work... cool! Thanks, Mark. Will try it on this next report I'm writing.

MIS Information (kate), Friday, 15 July 2005 09:25 (twenty years ago)

Hey, I was about to say HAVING! I wasted eight years of my life being Not Very Good at this stuff...

Michael Jones (MichaelJ), Friday, 15 July 2005 09:29 (twenty years ago)

Hrrmmm. Why can't I do multiple Outer Joins? So long as the left table is always the same, what's the problem?

Stupid Microsoft Query.

MIS Information (kate), Friday, 15 July 2005 09:47 (twenty years ago)

Hey, never mind all that "I was about to say!" I just rescued this thread off the very last entry on "New Answers"!

I wish you could manifest Inner Joins within a left outer. Instead you have to create a view and link to that!

mark grout (mark grout), Friday, 15 July 2005 09:53 (twenty years ago)

If I had some method or admin tools whereby I could create views within the actual database, instead of mucking about with all these crappy Microsoft and Crystal Query builders, none of this would be a problem. :-(

MIS Information (kate), Friday, 15 July 2005 09:57 (twenty years ago)

I just get told "DONT PUT VIEWS IN THE DATABASE, LINK TO Stored Procedures which call the view!"

mark grout (mark grout), Friday, 15 July 2005 10:00 (twenty years ago)

Yeah, I'm being told that now, (with the new system) but bloody hell, this database never has the views I want!

In my oracle database no one else ever goes in there, so I can create all the views I want.

MIS Information (kate), Friday, 15 July 2005 10:15 (twenty years ago)

seven months pass...
I don't think is an SQL question but I need help.

In a nutshell, we've got data for our organisation's contacts and such like hosted remotely on an SQL database. We've made significant changes to it recently, and wanted to upload new tables. To cut a long story short, our data hosts say that their insurance indemnity prevents them from assisting us, which means we can't upload the data we need to upload.

It appears we have two choices, neither of which I'm familiar with how to do:

1) Our database is a SQL Server one, so we need to create a new database in that, then either send our host company the raw datafiles (detached database) or a backup (.bak file) of the contents.

2) Setup a DTS job to import the records directly onto the SQL server from our local server

I'm afraid that I'm utterly stumped on both of these, and need some help. Can anyone advise, or even better, be able to help directly?

Yours hopefully.

Dave B (daveb), Thursday, 23 February 2006 13:29 (twenty years ago)

Detaching/backing up SQL Server databases is VERY EASY, fortunately. All you have to do is open SQL Server Enterprise Manager, connect to the database you want to detach/backup, right-click on it and go through the options under "All Tasks" until you find the backup option or the detach option.

I would give more explicit steps but I'm kind of going off dim memories here and I'm late for work.

Dan (Also Check Google For More Explicit Help: "SQL" "Server" "Detach" "Database, Thursday, 23 February 2006 13:35 (twenty years ago)

Ooh, I had to create a DTS job a bit ago to transfer data from one server to another. It's not *too* hard to do a simple one - if you start up Enterprise Manager, select your server, and go to "Tools -> Data Transformation Services -> Export Data..." it will fire up a wizard to create a new DTS package. You do need to be able to access both database servers from the one copy of Enterprise Manager to do it that way.

The big problem *I* had was that the wizard didn't know how to take account of foreign key relationships. So, the package it created wouldn't run, because it would try to import data into the new tables in the wrong order. The only way to get around it was to use the wizard's output as a starting point, make notes on where it failed, then use the DTS package editor to add dependancy data to the package - "do not copy B until A is complete" and so on. The DTS editor is graphical, so this is a matter of dragging arrows around on the screen.

xpost: as Dan says, detaching and transferring the data file is probably easier for what you're doing.

Forest Pines (ForestPines), Thursday, 23 February 2006 13:41 (twenty years ago)

Argh. I think I explained myself badly. This is wot the situation is:

- We had an access database
- That became an SQL one
- I copied the tables into Excel, did some clean up on them and want to put them back into the SQL databse.

The hosting company said nope, they couldn't write over the old tables with the new ones as their insurance didn't indemnify them for this. This means I have 4 tables in Excel which I want to put back into our SQL database / create a brand new database with. This is what I have no idea how to do - any tips? Better still, would anyone on here be able to do it for me? Happy to pay that special someone...

Dave B (daveb), Thursday, 23 February 2006 14:26 (twenty years ago)

how about copying the old database into a new one altogether (and keep the old one as an archive), clear all the data in the new database and ask company to re-load?

ken c (ken c), Thursday, 23 February 2006 14:41 (twenty years ago)

has the actual structure of the tables changed, too?

ken c (ken c), Thursday, 23 February 2006 14:41 (twenty years ago)

The DTS Import Wizard in Enterprise Manager should let you create a DTS job to import data into the database from Excel files.

Forest Pines (ForestPines), Thursday, 23 February 2006 14:46 (twenty years ago)

Copying data from Excel to SQL Server is v easy with DTS, but then I use DTS all the time.

Just create an Excel connection to the table, and Data Transformation Task to the SQL Server database you want to copy it to, bob's your uncle.

Colonel Poo (Colonel Poo), Thursday, 23 February 2006 14:46 (twenty years ago)

(you just need to select "Microsoft Excel 97-2000" as the data source type)

Forest Pines (ForestPines), Thursday, 23 February 2006 14:47 (twenty years ago)

but the problem is that the hosting company doesn't want a bulk upload over old data no?

ken c (ken c), Thursday, 23 February 2006 14:49 (twenty years ago)

Hmm well I have no idea about hosting companies, this is a new concept to me. Why would you get another company to host your data anyway? Oh well.

Colonel Poo (Colonel Poo), Thursday, 23 February 2006 14:51 (twenty years ago)

i guess it's some kind of data warehouse company that presumably provides better uptime/backup/disaster recovery etc.

ken c (ken c), Thursday, 23 February 2006 14:58 (twenty years ago)

need more info from dave though really

ken c (ken c), Thursday, 23 February 2006 15:00 (twenty years ago)

So, has anyone used the new SSIS (SQL Server 2005 replacement for DTS)? Do existing DTS packages upgrade, or do you have to rebuild them?

Jaq (Jaq), Thursday, 23 February 2006 15:09 (twenty years ago)

Haven't used it yet, but plan to soon as got copy of 2005 coming. I'm leaving this job soon so I need to have a look at 2005 before I leave so I can put it on my CV ;)

Colonel Poo (Colonel Poo), Thursday, 23 February 2006 15:14 (twenty years ago)

Yeah, we are prepping to move to it v. shortly. I've got it installed on my desktop but haven't upgraded anything yet. The import wizard thing is of course seamless on new stuff.

Jaq (Jaq), Thursday, 23 February 2006 15:16 (twenty years ago)

I would like to give you info but I r afraid I do not know.

Can I just create a new set of tables on Enterprise Manager and import the data from excel tables and then point the Access database at those new tables instead, and the leave the old tables there to slowly degrade, accuracy wise?

Dave B (daveb), Thursday, 23 February 2006 15:20 (twenty years ago)

I was with you up until the "point the Access database" part because I've never used Access. Everything else made sense to me.

Dan (Not As Helpful As I Thought) Perry (Dan Perry), Thursday, 23 February 2006 15:23 (twenty years ago)

Dave, is your Access database the front end to entering/modifying stuff in the SQL database?

Jaq (Jaq), Thursday, 23 February 2006 15:25 (twenty years ago)

you should be able to just create the new tables yeah. or even a new database altogether with the same table names etc.

who set up the original tables in the first place?

ken c (ken c), Thursday, 23 February 2006 15:32 (twenty years ago)

Yes - to Jaq's question

To Ken's - it is lost in the mists of time

Dave B (daveb), Thursday, 23 February 2006 15:46 (twenty years ago)

When you add the replacement tables to your database, you might have to re-establish whatever relationships existed to the original tables (if there even were any).

Jaq (Jaq), Thursday, 23 February 2006 15:49 (twenty years ago)

I think you should be able to create new tables in your SQL database, then reroute your Access links to point to the new tables using the Linked Table Manager, or whatever it's called.

Alternatively, do something like what Ken suggested: make new tables with backup copies of the old data, then delete the actual tables' contents and replace with the new data.

Forest Pines (ForestPines), Thursday, 23 February 2006 15:51 (twenty years ago)

one month passes...
Argh! Boring Microsoft Query problem!

OK so I usually use SQL Server 2000 so am not used to dealing with MS Query (in Excel)

How do I use date functions in Query??

I want to do something like this:

SELECT * FROM [TABLE]
WHERE order_date = getdate()

But Query won't accept getdate, now, date, or anything else I can think of. Is it just too fucking shit to deal with date functions? There's nothing in Help about it.

I have a workaround using a parameter, i.e.

SELECT * FROM [TABLE]
WHERE order_date = ?

and then put =today() in a cell on teh Excel sheet and use that as the parameter, but that can't be the best way to do it, surely??

Colonel Poo (Colonel Poo), Tuesday, 4 April 2006 11:51 (twenty years ago)

I don't see any other way, Colonel. MS Query seems to be a very limited subset of SQL.

Jaq (Jaq), Tuesday, 4 April 2006 13:57 (twenty years ago)

NOW()

?

mark grout (mark grout), Wednesday, 5 April 2006 08:46 (twenty years ago)

i need a ruby on rails guy to do a freelance project. anyone anyone?

phil-two (phil-two), Friday, 7 April 2006 21:49 (twenty years ago)

please?

phil-two (phil-two), Friday, 7 April 2006 21:51 (twenty years ago)

CHANGE THREAD TITLE TO "SOL" PWNED

Fight the Real Enemy -- Tasti D-Lite (ex machina), Friday, 7 April 2006 22:11 (twenty years ago)

six months pass...
>> So, has anyone used the new SSIS (SQL Server 2005 replacement for DTS)? Do existing DTS packages upgrade, or do you have to rebuild them?

-- Jaq (js...), February 23rd, 2006 3:09 PM. (Jaq) (link)

I'm now attempting to use it and it's fucking horrible. I didn't have too much trouble using DTS apart from a couple of bugs here and there, but this SUCKS.

It's not even stable. I was copying 700,000 rows from one server to another, and it ended up inserting the data from 500,000 of them into one row. I ended up with a varchar field of length 512,000,000. I've since worked out this happens when the server is running low on memory, so I can't run anything else when an SSIS package is running. Great.

Today I found that the SQL Server Destination object is basically useless, as trying to copy a datetime field from OLE DB Source (also SQL Server) to SQL Server Destination will fail with a type conversion error, even though the source & destination columns are both datetime. You have to use an OLE Destination DB object for it to work.

And apparently the migration tool to upgrade DTS to SSIS is so unreliable even Microsoft have advised not to use it.

ARGH. I know it's a Microsoft product, so I shouldn't be surprised, but this is SO BAD it defies all expectation. I'd rather just write everything in stored procedures than use this, but I don't think my manager will agree unfortunately, so I'm stuck with it :'(

Colonel Poo (Colonel Poo), Tuesday, 10 October 2006 13:37 (nineteen years ago)

five months pass...
Does anyone know how to export images (specifically jpegs) from a varbinary field?

If I do this:

declare @cmd nvarchar(4000)
set @cmd = 'bcp "SELECT TOP 1 Photo FROM dbo.ImageWarehouse" queryout "c:datatest2.jpg" -T -n'

exec xp_cmdshell @cmd


trouble is, BCP doesn't output the data as it is in the bastard table. Instead it adds 4 bytes to the beginning of file (AB 8A 00 00). If I edit the file and remove the offending 4 bytes, it opens as an image. Any idea what's up? I can't see an obvious problem with the BCP command.

Colonel Poo, Monday, 2 April 2007 15:06 (nineteen years ago)

Never mind, extensive googling reveals this to be a bug with BCP. How strange, a Microsoft program that doesn't fucking work properly.

Just in case anyone else has this problem - use TEXTCOPY.exe instead, that does the trick.

Colonel Poo, Monday, 2 April 2007 16:19 (nineteen years ago)

one year passes...

hey so like.. i'm running a website on drupal and somehow ran out of memory on my virtual machine - bringing it to its knees! are there any simple diagnostic tools i can try to see if particular queries are being extra hoggy?

Tracer Hand, Wednesday, 14 January 2009 18:00 (seventeen years ago)

never used drupal but it's a php framework, right? what DB are you running under it? mysql?

i spent WAY too much time today setting up the MySQL-python-1.2.2 lib. I love open source- build, error. google error. fix file. build. get new error. google. fix new error. build. reads config wrong. fix config. build. repeat 3 more times. finally install. 25 minutes down the drain. on the other hand, it's a nice lib once it's running.

lyra, Wednesday, 14 January 2009 22:15 (seventeen years ago)

getting ruby on rails to work with mysql on Leopard was the delightful way I spent my entire day.

akm, Wednesday, 14 January 2009 22:26 (seventeen years ago)

My best is that it's not MySQL going badzooks, Tracer. Use top or a similar tool to track down who's hogging memory at the process level. That'll at least allow you to rule out MySQL.

Carne Meshuggah (libcrypt), Wednesday, 14 January 2009 22:43 (seventeen years ago)

I was trying to re-install mysql because I'd forgotten the root password, and was trying to follow the instructions <a href="http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html";>here</a> except that at the step where I'm supposed to enter "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld.exe", something funky happened. Now, every time I boot up my computer, mysqld.exe crashes. I can at least bring up the mysql console, though I can't do anything because I don't have the password. A regular uninstall/reinstall doesn't fix things. Is there a way to unfubar things, or at least start over with a clean uninstall?

Leee, Thursday, 15 January 2009 06:12 (seventeen years ago)

Nuke the database directory. Also, you don't need to reinstall to reset the root password on MySQL.

Carne Meshuggah (libcrypt), Thursday, 15 January 2009 08:07 (seventeen years ago)

Database directory being where Mysql is installed?

Leee, Thursday, 15 January 2009 23:20 (seventeen years ago)

Not necessarily. The directory where all the database files are kept. I don't know where this is on Windows.

Carne Meshuggah (libcrypt), Thursday, 15 January 2009 23:50 (seventeen years ago)

running Mysql on windows is just wrong. but yeah, one of your endless config files should tell you where you have that directory.

lyra, Friday, 16 January 2009 01:37 (seventeen years ago)


You must be logged in to post. Please either login here, or if you are not registered, you may register here.