Posts Tagged ‘sql’
SQL SELECT CASE Instead of IIF
I’ve had to do this a couple of times and I just realized I haven’t written about it anywhere.
If you need to SELECT a field from a row that returns different content based on the content of the field, you’d think, based on previous programming experience, that your code would look something like this.
Other Related Items:
SoundGate M2 German engineered to safely secure your iPod, iPhone, Nano, Touch, Classic, Garmin, Cell Phone, Blackberry, Zune, MP3, or other portable device to your dash, or consolemount for portable electronic devices,adjustable tilt -- folds flat when not in use
PlayStation 2 Dualshock Controller BlackThe standard controller for the PlayStation 2 computer entertainment system, the DUALSHOCK 2 analog controller delivers a more intuitive gaming experi... Read More >
Worst CaseBest case: survivalThe son of one of New York's wealthiest families is snatched off the street and held hostage. His parents can't save him, b... Read More >
SQL For Programmers – New Question
I got this question last week that I thought would be worth discussing on the blog.
I would like to create a table that lists contributions by date, amount, and designation. In some cases one gift was split two (or more) ways. For example, a contribution of $1000 was given, and $500 went to the scholarship fund and $500 to athletics. The gift date would be the same for both gifts, but they must be recorded separately in order to split the gift. In my new table, I want to list them in rows like this:
date| amount| designation1, designation2, designation3, etc.Would it be best to use a cursor or a stored procedure. I’ve never done anything like this before, so I’m not sure where to begin.
Other Related Items:
Heath Outdoor Products SQL-2 Corn Log Squirrel TreatSweet Corn Flour, Corn Meal.
SQL – Transactions
Ruth ask,
How do I do transaction tracking within a stored procedure?
Hopefully, if you’ve been programming for any length of time against databases, you know that if you are updating multiple records in a database, you need to supply some sort of transaction tracking so that it either all works or all fails.
You do know that, right?
Well, maybe we should cover that in a future post.
But today, what happens if you have a stored procedure that updates multiple records in the database? I can’t depend on the programmer to implement transaction tracking because all he sees is one call. How is he supposed to know that it’s updating multiple records and should turn on transaction tracking in his code?
Other Related Items:
Why He's Dating Her (Instead of You) - Why He Didn't Commit, Why He Left, and Why You're Still Hooked - 10 Ways to Be the Woman Every Man Wants"Why Men Fall for Some Women and Not Others..." Why do some women get the attention of all the great guys, while others end up alone...or with "littl... Read More >
Commit Random Acts of Kindness & Senseless Beauty. -Bumper StickerBumper Sticker promoting acts of spontaneous kindness and generous beauty
Oakley Women's Commit Iridium SunglassesOakley has the honor of serving countless female athletes who commit themselves to the highest standards of personal achievement. For them they made t... Read More >
SQL – Filtering WHERE condition on two rows
I received the following question a couple of days ago from a programmer using the “Ask a Question” form which you can access from the menu of this blog:
Given the following table:
| Name | Language |
| Nikhil | Hindi |
| Nikhil | English |
| Kisu | Hindi |
| Kisu | English |
| Rakesh | Hindi |
| Kousik | Bangali |
How do I select names of persons who know both Hindi and English?
In this table, that query should return Nikhil and Kisu.
Other Related Items:
The Big TabooThe Big Taboo is just like the Taboo you know and love, but now it has four fantastic ways to play! Race against the timer to get as many guess words ... Read More >
Bratz KidzWelcome to the Bratz Kidz Slumber Party! Join your favourite Bratz Kidz characters for a game filled with all the fun of a late night party no boys ... Read More >
Access 2007: The Missing ManualCompared to industrial-strength database products such as Microsoft's SQL Server, Access is a breeze to use. It runs on PCs rather than servers and... Read More >
Random in SQL – SQL For Programmers
Last week I had an interesting assignment: Given a specific record, randomly retrieve three related records from the database.
Naturally, as a programmer, I started looking for the SQL random function. Which I found.
But even as I was searching for how to use that function, I was thinking to myself, “How am I going to structure things in such a way so as to randomly select the records once I have the function? It isn’t like I can retrieve the records into an array and then select them out. Am I going to have to retrieve them into a temp table?”
Other Related Items:
Dr. Seuss's ABC: An Amazing Alphabet Book!BIG R, little r,what begins with R?
Rosy's red rhinoceros.
R...r...R
From Aunt Annie's Alligator to Rosy's red rhinoceros to a Zizze... Read More >
Richard Scarry's Best Busy People Video Ever!: (Kids First Award winner) [VHS]Huckle, Lowly Worm, and rest of the schoolchildren are inspired by their teacher's discussion about different kinds of occupations and what people in ... Read More >



