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.
| Author |
Topic |
|
iswan
Starting Member
28 Posts |
Posted - 2007-07-19 : 07:16:27
|
| Hai I have one dowt in the column concatinationInput Table:TestRowID EFirstName ELastName ENo1 Rez Ali 12 RAABU NULL 23 Sam NULL 3Needed Output Str:1~Rez~Ali~12~Raabu~~23~Sam~~3Query: declare @Tex varchar(1024)select @Tex=* from Test where RowId=@iPRINT @TexI am trying like this but don't know How to get this outputIswan |
|
|
iswan
Starting Member
28 Posts |
Posted - 2007-07-19 : 07:45:18
|
| Ya, I Found it the queryselect a1+'~'+case when a2 is null then '' when a2 is not null then a2 end from Test where RowID=@iThanks |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-19 : 07:54:15
|
You can use isnull() or coalesce() functionSELECT a1 + '~' + ISNULL(a2, '')FROM Test WHERE RowID = @i KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|