Monday, November 05, 2007

T-SQL: Concatenate something + null=null

Today I have lost 2 hours until I have discovered this rule. I wanted to concatenate the contents of a field in the database with a variable using something like that:

UPDATE TableName

SET FieldName=FieldName + ',' + @value
WHERE ID=@ID

If the value of FieldName is null this operation is very stupid because the result will be null too. In my case I have forced that the field was not nullable (default value: '') and all runs.

33 Comments:

At 10:30 PM, Blogger Alex Beynenson said...

What about something like this instead of changing the schema?

UPDATE tbl
SET fld = ISNULL(fld, '') + @value

This would ensure that for columns which are null, you would concatenate with a blank string.

 
At 9:27 PM, Anonymous Anonymous said...

vaya crack!

 
At 2:26 AM, Anonymous Anonymous said...

This worked nicely!

 
At 11:17 AM, Anonymous Anonymous said...

I am not going to be original this time, so all I am going to say that your blog rocks, sad that I don't have suck a writing skills

 
At 9:51 AM, Anonymous Anonymous said...

I'm looking forward to getting more information about this topic, don't worry about negative opinions.

 
At 1:57 AM, Anonymous Anonymous said...

buy facebook likes
get facebook likes

http://entrepreneurship.unica-network.eu/content/peter-drucker-society-europe-launches-essay-contest http://phasmid-study-group.org/content/Phasmid-Studies
buy facebook likes buy facebook likes get facebook likes
I've always had no problems with getting internet on my computer. Now I can't connect. I've checked and everything is plugged in. I don't think it is a problem with the cables because I don't get the message "Local cable disconnected". All the other computers in my house are working fine. I think that something is wrong with the actual computer. I had a trojan (InternetSecurity2010) before that happened, maybe that has something to do with it? I've tried Internet Explorer, Firefox, and Safari. Other odd things are happening too...after a few hours or so none of the applications will work (iTunes, microsoft word, etc) and a lot of the words start to disappear. Likeee, the start button at the bottom left corner doesn't say start, it just is a green blob and when you click on it, it only shows the picture for each application. I've run spybot and malwarebytes scans and they both came up with nothing. I dont have any actual antivirus to run because I was in the middle of downloading Kaspersky Anti Virus when it happened and whenever I put in the code, it says that it can't download because it can't access the internet. Any ideas?

buy facebook likes get facebook likes [url=http://1000fbfans.info]buy facebook likes [/url] get facebook likes

 
At 12:39 PM, Anonymous Anonymous said...

It is closely related to the various organs, the importance is selfevident. Dodge, and now she regularly checks online for cheap car insurances. asus sl vpn firewall router. About two weeks before the actual act of conception, the uterus starts to grow a very blood rich layer of tissue on its inner lining. These equipments are usually required in completing earthwork operations., list of proxy websites. From the existing businesses, find out how you can gain a competitive advantage over them. what are vpns

 
At 1:02 PM, Anonymous Anonymous said...

Now fill the artificial grass surface with fine, kilndried sand. von zipper uk

 
At 1:20 AM, Anonymous Anonymous said...

There’s a mixture of culinary highlights to be found in the many restaurants and diners. We do not charge exorbitantly for our termite service and assure you true value for money., vpn endpoints. Studies reveal the fact that nearly seventy percent women might get ovarian cysts at any point of time. reseaux vpn

 
At 11:02 PM, Anonymous Anonymous said...

top [url=http://www.001casino.com/]free casino bonus[/url] coincide the latest [url=http://www.realcazinoz.com/]free casino[/url] manumitted no deposit reward at the foremost [url=http://www.baywatchcasino.com/]online casinos
[/url].

 
At 3:22 AM, Anonymous Anonymous said...

By using products with more than one function you will save time and money by not having to use separate products. vpn latency high

 
At 4:37 AM, Anonymous Anonymous said...

Do you wish to see at night? linksys vpn remote. There are several good reasons to heat a workshop or garage space with an infrared heater. unblock ssl

 
At 5:53 AM, Anonymous Anonymous said...

A problem for smokers to anticipate is during interview sessions with an interviewer who is a nonsmoker. cheap proxy

 
At 11:03 AM, Anonymous Anonymous said...

Not only for the materials but we love to have such a package option while we tour a well., virtual dj ejay. It definitely makes a bold statement, but is bound to pinch you where it hurts most; your pockets. It’s easy to simply to tell people to shop around, but this is a rather simplistic explanation. virtual deep sea. If your domain is not locked, the failure to respond to the registrars email request for change is an automatic "approval" of the transfer. colortyme intranet

 
At 11:49 AM, Anonymous Anonymous said...

Remember, your paper contributes a lot to the overall impact that your brochure printing creates. It outdoes previous technology with its greater clearness and definition in both playback and recording, its bright colors, and crisp audio as well., filezilla ftp server and. They analyze the building and makes aware about the relevant facts like where and what type of lighting fixture should be fasten. how to install a linux server

 
At 12:22 PM, Anonymous Anonymous said...

The instant you feel that something is in the wrong, you can go down with that nippy payday online loans giver and select for any other choice. The agency will try to get you to send them in, and then try to submit your friends to other companies., troubleshooting outlook web access in microsoft exchange 2003. They increase your sales and enhance your marketing program. server 0 93

 
At 1:38 PM, Anonymous Anonymous said...

It is up to you to think what you will have on but memorize that people will make judgments about you based on that. Let’s begin with trying to reduce some of the cost. or socks. Each day write at least one thing you are grateful for or that you can see as a blessing in your life. My world shrank smaller and smaller by the day., add network printer for all users. The students in this case do not require wandering about from one place to the other in order to acquire knowledge of a particular field. develo remote resource sensing v

 
At 9:42 PM, Anonymous Anonymous said...

So, the man and woman wear this separately during the engagement period then the man would actually take his off during the wedding day and “connect” it to the woman’s by virtue of its interlocking design. They can additionally show you of which vitamin supplements are generally ideally suited on your health, and which ones you need to include in what you eat. grout sealer private label. By using a web template you can jump start your website in a matter of few days, as soon as you are ready with your content and image bank. Laptop radiation is concentrated in the top of the keyboard, the best to use a external keyboard., fedora 13 vpn server. First, any significant variation between the incident angle of the punch and the exiting hair can result in graft transaction. infrared remote controler

 
At 9:50 AM, Anonymous Anonymous said...

The point is you have to survey. tricerat screwdrivers client

 
At 12:30 AM, Anonymous Anonymous said...

So where are you going to find powerful information like this, that will enable you to tap into a 450 million customer market, before all your competition does? kyoto protocol of 1997

 
At 1:22 AM, Anonymous Anonymous said...

No need to spend for a whole setup., free email server windows server. And as its name implies, multiple negatives can expect the complete opposite of the multiple positives. Generally, alarm systems are used in places that deal and handle money like banks, lending institutions or even money changers. colony nudist picture private. Indeed, at the moment, only titanium and alloys where it is dominant have been known to eventually get successfully integrated into the body. nebraska sports network

 
At 9:41 AM, Anonymous Anonymous said...

Anti aging creams are easy to use and if any negative side effect is detected, you just have to stop using them, as simple as that., libexec libphp so into server. It’s no longer too surprising to admit that technology or advertising software strategies. If you are interested to make a visit to the head office of this company then it is also possible because you can easily find the address on the contact page of the website. free network messengers. It does have many advantages; however, there are certain limitations to be considered. gmp private client

 
At 6:01 PM, Anonymous Anonymous said...

Ask them to mention your business on their company or personal website if they have one. With this technology you are able to personalize email as well as schedule when it will be sent out., microfracture protocol. Why do we need web hosting? pulse atm network

 
At 8:28 PM, Anonymous Anonymous said...

As we all know, depends primarily on molecular features of its unique threedimensional structure., avantaj client. A stepby step approach can help overcoming this issue. So much more than clearing arteries are the result of this naturally occurring process. tor anders welt. Are you looking for cell phone skins of your own choice? door access control system

 
At 11:33 AM, Anonymous Anonymous said...

Hi, yup this post is truly fastidious and I have learned lot
of things from it about blogging. thanks.

my page :: Zebra 2824

 
At 7:56 PM, Anonymous Anonymous said...

Thanks a lot from Glenarm ;)

Feel free to surf to my blog newsletter printing

 
At 6:19 PM, Anonymous Anonymous said...

Regards from Clonmore ;)

Review my web page; large posters

 
At 7:24 PM, Anonymous Anonymous said...

Spot on with this write-up, I absolutely believe that this site needs a lot more attention.
I'll probably be back again to read more, thanks for the advice!

my web-site best vps

 
At 12:14 AM, Anonymous Anonymous said...

Your means of telling the whole thing in this piece of writing is in fact
good, all can without difficulty understand it, Thanks a lot.

how to get 1 million twitter followers

 
At 5:03 PM, Anonymous Anonymous said...

Hi! Do you use Twitter? I'd like to follow you if that would be okay. I'm definitely enjoying your blog and look forward to new updates.


My webpage ... toddlerhitting.org

 
At 5:25 AM, Anonymous Anonymous said...

Request the preceding operator a great deal of concerns.


Take a look at my page - more helpful hints

 
At 10:09 PM, Anonymous Anonymous said...

A single from the well-liked bodyweight reduction infomercials a couple
many years ago was the Skinny Swap Diet.

Also visit my page :: http://www.getfitnstrong.com/bowflex-dumbbells/bowflex-adjustable-dumbbells/

 
At 9:03 AM, Anonymous Anonymous said...

smokeless cigarettes, buy electronic cigarette, e cigarettes, e cigarette, electronic cigarette, e cig reviews

 

Post a Comment

<< Home