PC Review


Reply
Thread Tools Rate Thread

Concat two columns in a SELECT with NULL (Access)

 
 
Martin Rothschink
Guest
Posts: n/a
 
      16th Jun 2005
Hi,

to concat two columns in Access I can use + or &. If I use + the NULL
pushes through, so I want to use &.
Example: SELECT Firstname & ' ' & Lastname AS Name ...

Problem: The OleDbCommand object doesn't accepts & in a SQL statement,
only + is allowed.

But now I get empty data if Firstname is NULL.

Does anybody know the trick?

Regards
Martin



 
Reply With Quote
 
 
 
 
Rogas69
Guest
Posts: n/a
 
      16th Jun 2005
Hi Martin

You should check if given field is null - did not read it, but I suppose
concatenation of strings, where one of them is null gives you null?
Use following construct (was in help)

select IIf(IsNull([Firstname]), " ", [Firstname]) ...

Peter


 
Reply With Quote
 
Martin Rothschink
Guest
Posts: n/a
 
      17th Jun 2005
Rogas69 wrote:
> Hi Martin

[...]
>
> select IIf(IsNull([Firstname]), " ", [Firstname]) ...


Thanks.
Martin


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to concat from another table field w/in my select? ZX Microsoft Access Queries 3 15th Dec 2007 04:09 AM
how can I count columns that are null by department in an access 2 =?Utf-8?B?VGFzc28=?= Microsoft Access 3 1st May 2007 02:28 PM
Concat and summarize 6 columns to 2 columns italia Microsoft Excel Programming 0 18th Oct 2005 07:54 PM
How do I select distinct for 2/5 columns queries in Access =?Utf-8?B?U25lZWQ5MjQ=?= Microsoft Access Queries 5 25th May 2005 11:02 PM
Access SQL SELECT * FROM X WHERE [Field] = null statement Sam Microsoft C# .NET 2 4th Apr 2005 10:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:22 AM.