Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Recursive concatenation(?)

Author  Topic 

t1g312
Posting Yak Master

148 Posts

Posted - 2004-07-31 : 00:53:04
Hi all,

@a = @a + @b (where @a and @b are varchar) doesn't seem to work. Any idea why?

Thanks

Adi

-------------------------
/me sux @sql server

kselvia
Aged Yak Warrior

526 Posts

Posted - 2004-07-31 : 01:28:57
varchar or varchar(nn)? varchar is 1 character if you don't specify a length. Also, @a and @b can not be null or the result will be null, other than that, what you described should work fine.


--Ken
Your Kung-Fu is not strong. -- 'The Core'
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-31 : 01:59:55
If @a or @b might be NULL then try

SELECT @a = COALESCE(@a, '') + COALESCE(@b, '')

Kristen
Go to Top of Page

t1g312
Posting Yak Master

148 Posts

Posted - 2004-07-31 : 03:00:29
It works now. Thanks Kristen and ken!

Adi

-------------------------
/me sux @sql server
Go to Top of Page
   

- Advertisement -