Friday, February 24, 2012

Custom Col. Format

Hi All, This is what I am trying to accomplish
SELECT a query from SQL2k2 export to Excel 2k.
When I populate excel workbook I need the data to be formatted in certain
order (esp. my column values should have comma) like 10000 should be 10,000
Unfortunately not allowed to write macros or any VBA's in excel...so the
only way to do would be
Format the data in SQL before sending to Excel...
can someone provide me a headstart?
TIA
-- pseudo code looking for something like this
-- create table T (myCustomCol varchar(20) Format(#,##,###)Vai2000,
1. Create your table in SQL Server
2. Populate the table with data
3. Create a view with the data format required
4. Use DTS to export the data from the view to the Excel workbook
5. Schedule the DTS package as a job for automation
HTH
Jerry
"Vai2000" <nospam@.microsoft.com> wrote in message
news:OQBg0dbzFHA.3924@.TK2MSFTNGP14.phx.gbl...
> Hi All, This is what I am trying to accomplish
> SELECT a query from SQL2k2 export to Excel 2k.
> When I populate excel workbook I need the data to be formatted in certain
> order (esp. my column values should have comma) like 10000 should be
> 10,000
> Unfortunately not allowed to write macros or any VBA's in excel...so the
> only way to do would be
> Format the data in SQL before sending to Excel...
> can someone provide me a headstart?
> TIA
> -- pseudo code looking for something like this
> -- create table T (myCustomCol varchar(20) Format(#,##,###)
>|||See function "convert" in BOL.
Example:
select parsename(convert(varchar(25), cast(12345678 as money), 1), 2)
go
AMB
"Vai2000" wrote:

> Hi All, This is what I am trying to accomplish
> SELECT a query from SQL2k2 export to Excel 2k.
> When I populate excel workbook I need the data to be formatted in certain
> order (esp. my column values should have comma) like 10000 should be 10,00
0
> Unfortunately not allowed to write macros or any VBA's in excel...so the
> only way to do would be
> Format the data in SQL before sending to Excel...
> can someone provide me a headstart?
> TIA
> -- pseudo code looking for something like this
> -- create table T (myCustomCol varchar(20) Format(#,##,###)
>
>|||Thanks but my data getting exported to excel doesn't has comma, since my
Table in SQL is a regular INT column!
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:uFoV1hbzFHA.2132@.TK2MSFTNGP15.phx.gbl...
> Vai2000,
> 1. Create your table in SQL Server
> 2. Populate the table with data
> 3. Create a view with the data format required
> 4. Use DTS to export the data from the view to the Excel workbook
> 5. Schedule the DTS package as a job for automation
> HTH
> Jerry
> "Vai2000" <nospam@.microsoft.com> wrote in message
> news:OQBg0dbzFHA.3924@.TK2MSFTNGP14.phx.gbl...
certain
the
>

No comments:

Post a Comment