Hi All, How to define a column in sql2k with format of its value as
10,000,000
TIA"Vai2000" <nospam@.microsoft.com> wrote in message
news:eBl8SrazFHA.3188@.TK2MSFTNGP14.phx.gbl...
> Hi All, How to define a column in sql2k with format of its value as
> 10,000,000
>
> TIA
>
Formatting is a front-end issue. You should probably create the column as a
BIGINT, or some type of Decimal.
Rick Sawtell
MCT, MCSD, MCDBA|||Hi
create table #t
(
col1 int,
col2 as convert(varchar,cast(col1 as money),1)
)
insert into #t values (10000)
select * from #t
If it does not help you ,please lookup SUBSTRING system function in the BOL
"Vai2000" <nospam@.microsoft.com> wrote in message
news:eBl8SrazFHA.3188@.TK2MSFTNGP14.phx.gbl...
> Hi All, How to define a column in sql2k with format of its value as
> 10,000,000
>
> TIA
>|||You don't. Formatting is controlled by your client application, not by
SQL Server.
If it's a numeric column then use one of the numeric datatypes.
David Portas
SQL Server MVP
--|||how about if you are exporting data to excel and want to populate in excel
in that format...avoiding writing format in excel...
TIA
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1128957032.919975.66170@.f14g2000cwb.googlegroups.com...
> You don't. Formatting is controlled by your client application, not by
> SQL Server.
> If it's a numeric column then use one of the numeric datatypes.
> --
> David Portas
> SQL Server MVP
> --
>|||"Vai2000" <nospam@.microsoft.com> wrote in message
news:%23F4F4EbzFHA.2792@.tk2msftngp13.phx.gbl...
> how about if you are exporting data to excel and want to populate in excel
> in that format...avoiding writing format in excel...
Still a front-end issue.
Storing is not the same as displaying or migrating.
If you want to migrate it as something else, then you have multiple options.
You could create a view and convert it to just about any format that you
wish.
Rick Sawtell
MCT, MCSD, MCDBA|||Thanks, I am looking the convert format to the desired Column
type..(1,00,000)
"Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
news:OZNzqIbzFHA.612@.TK2MSFTNGP10.phx.gbl...
> "Vai2000" <nospam@.microsoft.com> wrote in message
> news:%23F4F4EbzFHA.2792@.tk2msftngp13.phx.gbl...
excel
>
> Still a front-end issue.
> Storing is not the same as displaying or migrating.
> If you want to migrate it as something else, then you have multiple
options.
> You could create a view and convert it to just about any format that you
> wish.
>
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>|||how to convert a view to desired format?
Thanks a lot
"Vai2000" <nospam@.microsoft.com> wrote in message
news:%23sqAnObzFHA.3312@.TK2MSFTNGP09.phx.gbl...
> Thanks, I am looking the convert format to the desired Column
> type..(1,00,000)
>
> "Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
> news:OZNzqIbzFHA.612@.TK2MSFTNGP10.phx.gbl...
> excel
> options.
>|||"Vai2000" <nospam@.microsoft.com> wrote in message
news:%23iPvPQbzFHA.3660@.TK2MSFTNGP15.phx.gbl...
> how to convert a view to desired format?
> Thanks a lot
Take a look at the CONVERT function in SQL Server.
-- Create a table variable to hold our data.
DECLARE @.Foo TABLE (
x bigint
)
-- Load a value
INSERT @.Foo VALUES (10000000)
-- Convert BigInt to money datatype, then convert the money to a character
string and specify the "1" flag
-- so that commas are added in the appropriate place.
SELECT CONVERT(varchar(20), CONVERT(money, x), 1) FROM @.Foo
Rick Sawtell
MCT, MCSD, MCDBA
No comments:
Post a Comment