Generate Excel in SQL SERVER [closed]

1

Good afternoon.

I need to generate an excel file by SQL SERVER. And I need to specify the data type of the cells in that file.

For example, in value cells, set the data type to "R $" for example. In cell with percentage, already set cell data type to "%".

In C # this is done easily, but is it possible to do this in SQL SERVER?

I have the CLIENT table with the following structure:

NOME               DATANASCIMENTO         VALOR
Thiago Henrique    18-09-1988             52.50
Pedro Diniz        18-09-1988             12.67

I need to generate an excel file that exports this data where in the spreadsheet the NOME column has the data type with "Text", the DATANASCIMENTO column has the data type "Abbreviated Date" and column VALOR have the "Currency" data type

Thank you guys.

    
asked by anonymous 17.10.2016 / 22:20

1 answer

3
  

I am updating the answer with the export form via SQL command.

You can just copy and paste the data into an excel file, as shown in the image below:

SQlServeralsohasa"Wizard" to do this export. You can use it as follows:

Step 1: Right-click on the desired bank > Task > Export Data.

Afterthis,theWizardwillstarttheexport.Justfollowthestepsbelow.

Step2:Selecttheserveranddatabasewhereyouwillexportfrom.

Step3:Selectthetypeoffilegenerated(inthiscaseitwillbeMicrosoftExcel),thelocationwhereitwillbesavedandtheversionofexcel.>

Step4:Atthispointyouwillchoosebetweencopyingthetableorthecompletetables(firstoption)oraddingaquerytoreturnthedata.

Step4.1:Copydatafromoneormoretablesorviews.

Justselectthetableortablesthatwillhavetheexporteddata:

Step4.2:Writeaquerytospecifythedatatotransfer

Justaddthequeryinthespecifiedfield.

Step5:ClickFinishonthisorthefollowingscreen:

After this, the file will be in the location specified in Step 3 .

    
17.10.2016 / 23:41