Simple query question 08-05-10


I'm using SQL Server 2005.  What I want is to return a column "venue",
but if that column is null, I want to return the value of the column
"site" (in either case, I want the column header to be "venue").  How
do I construct such a query?

Thanks, - Dave
8/5/2010 5:30:44 PM
sqlserver.programming 1873 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 3

You can use expression with COALESCE and alias the expression as

SELECT COALESCE(venue, site) AS venue...

Plamen Ratchev
8/5/2010 6:15:56 PM
Try this:

  SELECT COALSECE(venue, site) AS venue
  FROM my_table


laredotornado wrote:
> Hi,
> I'm using SQL Server 2005.  What I want is to return a column "venue",
> but if that column is null, I want to return the value of the column
> "site" (in either case, I want the column header to be "venue").  How
> do I construct such a query?
> Thanks, - Dave
8/5/2010 6:16:36 PM

Similar Artilces:

Exchange 2003 Public Folder question...
Hi, We utilitze public folders, and I have enabled anonymous access to a couple of particular folders. My users that do not have AD user accounts can access these public folders via OWA. They use a URL that is similar to this: https://servername/public. This URL opens up the public folders page in IE. I have set up permissions on these particular folders so anonymous users can view other posts, and they can also create replies, and new messages, anonymously. My problem is that when an anoymous user is viewing a message that contains a URL to another website, and they click on the UR...

Query to list Company ID with Billing Period by number with date i
I have currently in one table: Company Number | Period Start | Period End 1 | x | y 1 | y +1 | z and so on....(10,000 companies) I would like to create a query that would make: Company Number | Period End 1 | Period End 2 | Period 3 1 | y | z | a 2 | c | d | e etc... Any ideas? Search on 'Cr...

Update 10.1.2 of Offic v.x
Everytime I install the 10.1.2 update, Installer Vise (installation=20 application) installs all the files in trash. Installer Vise gives me = the=20 option of installing in trash or office and I choose office. I don't=20 understand what's going on. Try emptying the trash before you update. Then, run the update, and make sure you select the proper Office X folder if prompted. The files you'll find in the Trash will be the old un-updated copies, and the new copies will be in the proper location inside the Office X folder. On 10/3/03 10:51 AM, in article 087e01c389c6$25c281e0$a...

Newsletter Production Question
I'm using Publisher 2003 and Windows XP Home to produce a monthly 20 pg Newsletter for our Civic Association. We would like to use a program to track members and produce address labels or merge addresses with Publisher to print on the newsletters. Please, can anyone recommend a product to do this? I know this isn't a publisher question but I feel this is a good group to ask because some of you are probably using MS Publisher to do something similar. It would be nice to also be able to record phone numbers and payment of dues. -- Bob Miller After...

"Operation must use an updateable query" error in IM
Our Client is running GP10 SP1 with all users connecting through Terminal Server to Sql 2005. Receiving error "Operation must use an updateable query" when trying to run an AP Transaction integration that has worked fine until this week. The source files are *txt files and they are not using any Sql scripting in the integration. I get that whenever I have an Access database that has somehow been marked read only or if the user I am logged in as only has read permissions. Since IM uses an Access database internally, I would suggest checking that the user who's logged i...

Maintenance Plan
Morning, I am creating my first maintenance job today and I have some general questions about the order of steps regarding the db and t-logs. I am looking to create 3 jobs that run nightly on a production database for my company. First Job: Check Database Integrity Reorganize Index Rebuild Index Update Statistics Check Database Integrity Second Job: Backup Database Cleanup History Third Job: Backup Transaction Log Execute T-SQL statement ( Truncate the Log) ... is this needed??? Maintenance Cleanup Task (Logs) I am not sure whether I have the correct ordering of t...

Average Question
I am trying to get the average of a column say a1 to a300, a1 to a15 has a number in each cell but the rest of the cells are currently blan but might have a number put in in the future. The problem I am having i when I use the =average a1:a300 it gives me an error saying I a dividing by zero. HELP!!!! Once Again Thanks In Advance Mik -- mikeee ----------------------------------------------------------------------- mikeeee's Profile: View this thread: this SHOULD...

Crystal Licenses 12-10-03
We have the Action Pack version of CRM loaded, and when we try to run a report we get : "Please verify that you have enough Crystal licenses" Is this because we have; 1. to buy and install Crystal 2. to enter a license for Crystal that we should have received with CRM 3. to finish the install because we screwed up someplace? What comes with CRM, and what do we need to buy (if anything) to run Crystal against the CRM DB? Thanks Ed Ed, There are plenty of errors that surround the Crystal config with CRM. You don't need to buy anything or enter a Crystal license to run ...

WTD, MTD, and YTD Queries
I'm trying to create a query that can total week-to-date, month-to-date, and year-to-date stats. I think a separate query for each would be easist? Also, prompting for each query would be preferred. An example of each record would be: Business Date 11/01/07 Calls Received 10 Calls Answered 8 Business Date 11/02/07 Calls Received 20 Calls Answered 17 When I use the Between () And () function, it doesn't sum the Calls Received and Calls Answered together (MTD), but sums them for each day. Thanks in advance! Try this --- SELECT [Enter start] AS [Begining Period], [Enter end] AS ...

Query to check a field and select fields from a table
I have 2 tables (tServers and tTimezone) with the following structure: tServers: servername city tTimezone: city time1 time2 My query need to check if [tServers].servername is like "*DOWD*" and return a field "time" populating with [tTimezone].time2. I joined both tables using city. "Rodrigo Borges" <> wrote in message >I have 2 tables (tServers and tTimezone) with the following structure: > > tServers: > servername > city > > tTimezone: > city >...

Named range question
Hello all, I have a question for the Excel gurus which read these groups. I have had a look through the archives and as far as I can tell, there is no way to do what I want so I thought I'd ask here. Take the simple case of calculating forecast sales; if the market for widgets is x million per year and your forecast market share in that year is y%, then forecast sales for a given year = x * y Obviously it is possible to set up, for example, a named cell "market_share" and another "market_size" and then write the formula in a third cell for sales which has the ...

Excel query help with union select
First of all i want to thank the people here who have been answering my posts. I am learning alot as a beginner. This forum is very active and has some talented people. Now to the question, I am trying to get a union select to work on a past problem i worked on. The problem is that when i copy and paste in my code i dont seem to understand how to seamlessly paste in code without an error. Can someone tell me what i am doing wrong? There is something wrong with Defect$. Here is what i have, below, but near the top there is an error but i cant see it? while in ms excel using query ...

Upgarde from GP9 to GP 10
Dear Friends, I am planning to upgrade GP 9 to GP 10 in my environment. I went through lots of documentation already but would like to learn more to complete upgrade process as smooth as possible. Following is my current GP 9 environment: OS: Windows 2000 SP4 server GP: Version 9 IM: Integration Manager SQL Server: SQL 2000 SP3 I have a new server available so I plan to do the followings: OS: Windows 2003 SP1 (already installed) GP: version 10 SP2 + hot fixes (already done) IM: Intergration Manager + hot fix ( Installed) SQL Serv...

Date query
Hi everyone, Im trying to do a timesheet for a uni project but i am having grea diffuclty with one thing! The current coding meanms that when something is selected in A1, D shows todays date (2ndJune) which is what i want. The problem is that the next day(3rd) when i then say select A2, D shows the 3rd but changes A1 to todays date. Can anyone help, im desperate to get this right!!! Thanks steve; -- Message posted from Hi, Can you show us a snippet of the code? or post a small version of your sheet? I'm having difficulty envisioning what is causing the A...

Excel formula 01-31-10
I want to get a total of range b3:af3 for cells that has s= a number ex 2,5,3 and have a formula to give me totals for those entries? ?? -- Don Guillett Microsoft MVP Excel SalesAid Software "Rick" <> wrote in message >I want to get a total of range b3:af3 for cells that has s= a number ex >2,5,3 > and have a formula to give me totals for those entries? Check your earlier post. Rick wrote: > > I want to get a total of range b3...

excell #10
Hello, Iam trying very hard to find a fourmula in order to calculate holiday for my employees. The problem is as follow... If they are in the company for less than 2 years they are entitle to 20 days between the 1st of January and the 31st of december If they are in the company between 2 and 5 years they are entitle to 22 days from their anniversary date. If they are in the company for more than 5 years they are entitle to 25 days from their anniversary date. My problem is to take in consideration their anniversary date (ex starting date the 15 of march 2000 how many holidays does this perso...

International Money 2005 queries
Firstly - Apologies for raising International version queries in this forum. There does not appear to be a specific Australian NG. Ran 2005 Trial version O.K for the 60 days then brought Money Standard 'New for 2005' version a few weeks ago. Help|About shows it is Vrs A couple of queries. 1. There appears to be no built-in Help - selecting Help brings up a Help side panel with "A problem occurred, Please Try again link". Clicking on the link brings up "Get help with an MSN product" and a list of topics such as 'Billing, MSN Client, MSN Hotma...

Message Headers question
How can I make the message headers display more prominent so that I can see at a glance which headers have been viewed and which have not. At the moment my display shows a small weak blue arrow in the box under the Subject heading, this arrow turns grey when I've opened and closed the message. Thanks, John Upgrade to the newer beta: Gary VanderMolen, Microsoft MVP (Mail) "John Smith" wrote in message news:#7pM9JeJLHA.1744@TK2MSFTNGP06.phx.gbl... How can I make the message headers display more prominent so tha...

Query Access 97 from Excel 97
Not sure whether to post this under Excel or Access (I will try both)... I am trying to query an Access 97 database from Excel 97 by selecting: Data -> Get External Data -> Create New Query From the Query Wizard, I am able to see the tables within the database, but not the fields. I am assuming it must be a permissions problem. I have given the Users group Open/Run permissions to the database, and I have given the same group Read Data & Read Design to the tables. Any ideas would be greatly appreciated... I am no expert but when I try a query, in the way you explained, ...

forgot to post version for previous question posted on update quer
In my previous question I forgot to state I'm using Office 2003 ...

XSLT question #2
Hi Can XSLT be applied for transforming .txt files or are they applicable only for xml to xml transformation. Currently all the clients send file to a server in one particular format. The format of the file which the server accepts is going to change. So we need to build an intermediate system which will do the transformation from the old format to the new format. Can I use XSLT for doing this? Is XSLT applicable only when xml to xml transformation is involved? Regards rjn *** Sent via Developersdex *** RJN wrote: > Can XSLT be applied for transfor...

Multi-threading question regarding MFC in a DLL..
Pardon for the stupid noobish question: WinXP Pro, VS .Net 2003 I have a client application which uses MFC (MFC dynamically linked) I have a DLL which uses MFC (regular DLL, MFC dynamically linked) The app calls ::LoadLibrary to load in the DLL, the DLL (when it initializes) creates a thread for performing calculations. The app then uses ::GetProcAddress to explicitly link to the exported DLL functions. Each exported DLL function's first line of code is: AFX_MANAGE_STATE( AfxGetStaticModuleState() ); As a test, I do something I know is bad, I have a string that is accessed (for r...

Three variable correlation 05-28-10
Hi. I was wondering if it was possible to work out the correlation between three variables in excel, not just two. My data looks like this (this is just an example, with random values): A B C 15,283,741,924 22,891,175,671 182,489,383 12,450,453,827 25,604,121,237 458,039,634 25,017,912,202 10,105,478,615 408,312,030 15,608,597,275 27,352,700,295 71,393,406 6,293,126,663 33,730,623,537 699,182,754 15,665,042,562 25,952,123,256 76,238,591 11,565,224,759 30,426,279,924 44,724,721 8,716,353,737 33,395,986,265 135,495,541 ...

calculation help 04-20-10
I will try to explain this I want to have a running total for C D F and G and use the numbers in A as a filter so if I filter the numbers = 33369 I want the totals of C D F G in other cells on the sheet (ie L6,M6,N6,O6) The data in A C D F G is entered maually > In the data below I want to calculate the column C ,D, F ,G but filtered by > Column A > A C D F G > > 33369 04/06/10 2 10 04/06/10 2 3 > 33369 04/07/10 0 11 04/07/10 2 10 > 33369 > 23456 > 2345...

Report Help 05-24-07
I have just created a report the prints to my label printer. The report has a text box for each line of the address with printing initiated from a button within the individual record on a form. My question is is there a way to suppress empty text boxes in the report as some of the records that don't have all the address fields populated look odd spaced out by the empty records Grateful for any help Paul In news:3ln5i.5530$, Paul Martin <> wrote: > I have just created a report the prints to my label printer. > > Th...