Automatically Export Data from SQL Database to CSV Excel File and Delete Table Automatically

Поділитися
Вставка
  • Опубліковано 11 лют 2025
  • Code for Exporting Data:
    SQLCMD -S DESKTOP-76IUJ1R -d TestDatabase -E -Q "select * from [tblDatabase] ORDER BY DatabaseCPU_Load" -s "," -o "C:\Users\Charlie\Documents\SQL Data\Database_Data%date:~10,4%%date:~4,2%%date:~7,2%.csv"
    Code for Deleting Data
    SQLCMD -S DESKTOP-76IUJ1R -d TestDatabase -E -Q "DELETE FROM [tblDatabase]"

КОМЕНТАРІ • 13

  • @shibinabraham7819
    @shibinabraham7819 Рік тому +1

    Very nice and very useful video. absolutely handy for every day tasks. Can you make a video on how to schedule the same task using SQL agent. Consider a scenario you have 30 data sets to be created. This means, you will need 30 SQL jobs to run each of these batch files, in case any of the jobs aren't working, easy to figure out the error and trouble shoot. Ideally, I am thinking to implement this for data visualization project in Qlik View, where these files (.csv) files will be imported as data sources into Qlik View and then that will be scheduled to get the real time (on an hourly basis).

  • @mosesakwagiobe4438
    @mosesakwagiobe4438 11 місяців тому

    very clear and straightforward although mine is not generating the file

  • @spk7054
    @spk7054 9 місяців тому

    you are no.1 thank you nice video training

  • @jedwards543
    @jedwards543 6 місяців тому

    Thank you! How can I do it to execute it with another user that I login to the SQL server using SQL server credentials?

  • @luisverastegui4311
    @luisverastegui4311 7 місяців тому

    I have a question, I compiled but I only see the black window for a few seconds and then nothing, the Excel was not created. Help please

  • @djsash9402
    @djsash9402 9 місяців тому

    Hi Charlie. Good evening. I am in these field of coding… Can you please help me in converting my Safari History.db to .csv, 'where the links can be ordered by the date accessed' ?
    Thanks in advance.

  • @KarinS-tk3qt
    @KarinS-tk3qt 9 місяців тому

    it gives me this error: " Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user " what should i do?

  • @vanminhtrip
    @vanminhtrip 10 місяців тому

    Thank y my Professor ❤❤❤

  • @Quoteswave2
    @Quoteswave2 10 місяців тому

    Hi how to export data from sql stored procedure to Excel with same steps that u have used in the video please help me

    • @Quoteswave2
      @Quoteswave2 10 місяців тому

      Actually im try to export data with 3 tables by joining them and some where conditions … im having issue so i wanted to convert to stored procedure and wanted to pull as per above ask

  • @ismailbeijermany1977
    @ismailbeijermany1977 10 місяців тому

    Ur name Schuld be professor thanks you very much