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 2008 Forums
 Transact-SQL (2008)
 Sql Function Like String.format

Author  Topic 

chiragvm
Yak Posting Veteran

65 Posts

Posted - 2013-07-02 : 09:54:16
Hi to all

is it any ready made function in sql (string.format in c#)
so we can use easily concate strings in select query insted of using (+)

-------------
Chirag
India
Sr. Sw.Engineer

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-02 : 09:57:19
quote:
Originally posted by chiragvm

Hi to all

is it any ready made function in sql (string.format in c#)
so we can use easily concate strings in select query insted of using (+)

-------------
Chirag
India
Sr. Sw.Engineer


No, SQL Server does not have an equivalent. There is a FORMAT function in SQL 2012, but that is not equivalent to the string.format in C#. http://msdn.microsoft.com/en-us/library/hh213505.aspx

But there is a CONCAT function, which is as close as you can get, but still not as flexible as String.format: http://msdn.microsoft.com/en-us/library/hh231515.aspx
Go to Top of Page

chiragvm
Yak Posting Veteran

65 Posts

Posted - 2013-07-03 : 06:22:11
thanks a lot James for giving this clarity about my question

-------------
Chirag
India
Sr. Sw.Engineer
Go to Top of Page
   

- Advertisement -