Custom data types  
Author Message
misterbeardy





PostPosted: Thu Feb 22 01:48:13 CST 2007 Top

SQL Server Developer >> Custom data types

I want to convert 9184772 to 9,184,772

--
Message posted via SQLMonster.com
http://www.hide-link.com/

SQL Server276  
 
 
Tibor





PostPosted: Thu Feb 22 01:48:13 CST 2007 Top

SQL Server Developer >> Custom data types Both values are the same. What you refer to is a presentation issue. When the data leaves SQL
Server, it is binary data. A client app formats the data, and most app does the formatting based on
meta-data (what data type is this?) instead of displaying the binary data.

Only way to enforce a specific format is returning is as a string, something I do not recommend. You
can check out CONVERT, for instance.

Another option is to use CLR datatypes (2005), and have the string representation taken care of in
your ToString() method.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/



>I want to convert 9184772 to 9,184,772
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200702/1
>


 
 
Uri





PostPosted: Thu Feb 22 02:38:57 CST 2007 Top

SQL Server Developer >> Custom data types Hi
select convert(varchar,cast('9184772' as money),1)




>I want to convert 9184772 to 9,184,772
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200702/1
>


 
 
www





PostPosted: Thu Feb 22 03:16:21 CST 2007 Top

SQL Server Developer >> Custom data types I would recommend dealing with it on the client side - whatever language you
are using do a convert , otherwise use the CONVERT function

--

Jack
___________________________________
The latest IT jobs - www.ITjobfeed.com



>I want to convert 9184772 to 9,184,772
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200702/1
>