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
 Analysis Services (2000)
 SQL Query

Author  Topic 

Harish Varma
Starting Member

4 Posts

Posted - 2011-09-20 : 06:09:42
how to concatenate a field with brackets around it in sql

N.HarishVarma

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 06:24:41
[code]select '(' + field + ')' from table[/code]

provided field is of type varchar

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Harish Varma
Starting Member

4 Posts

Posted - 2011-09-20 : 06:54:18
thanx 4 ur time visakh16


N.HarishVarma
Go to Top of Page

Harish Varma
Starting Member

4 Posts

Posted - 2011-09-20 : 06:58:43
if v want to concatenate with numeric what issue will arise i am doing the same think trying to concatenate with numeric field
i.e its sum(...) to this sum field i'm trying to concatenate

N.HarishVarma
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 07:15:23
[code]

select '(' + cast(field as varchar(100))+ ')' from table


[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Harish Varma
Starting Member

4 Posts

Posted - 2011-09-20 : 07:29:17
Its working Sir..
Thank you very much..

N.HarishVarma
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 07:37:25
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -