Professional Web Applications Themes

DELETE *.csv from T-SQL - Microsoft SQL / MS SQL Server

I need for my SQL Server 2000 stored proc to delete a file from my network drive. I can't find the T-SQL equivalent to the VB 'KILL' function (there is a KILL function in T- SQL, but it does something else). Anyone know how to do it? Thanks in advance. Sean...

Sponsored Links
  1. #1

    Default DELETE *.csv from T-SQL

    I need for my SQL Server 2000 stored proc to delete a file
    from my network drive. I can't find the T-SQL equivalent
    to the VB 'KILL' function (there is a KILL function in T-
    SQL, but it does something else).

    Anyone know how to do it?

    Thanks in advance.

    Sean
    Sponsored Links
    Sean Guest

  2. #2

    Default Re: DELETE *.csv from T-SQL

    look at the xp_cmdshell in Books online. which will enable you to run a dos
    command.

    --
    -Vishal

    "Sean" <com> wrote in message
    news:009e01c35b6a$b0a17c60$gbl... 


    Vishal Guest

  3. #3

    Default Re: DELETE *.csv from T-SQL

    You can try using xp_cmdshell....

    exec master..xp_cmdshell 'del c:\file.csv'

    The account that SQL Server is running under will have to have rights to the directory. You may have to perform a 'net use' in order to map a drive that you can reference during the delete if the file is not on the SQL Server.

    --
    Keith, SQL Server MVP

    "Sean" <com> wrote in message news:009e01c35b6a$b0a17c60$gbl... 
    Keith Guest

  4. #4

    Default Re: DELETE *.csv from T-SQL

    EXEC master..xp_cmdshell 'DEL D:\*.CSV'

    --
    David Portas
    ------------
    Please reply only to the newsgroup
    --

    "Sean" <com> wrote in message
    news:009e01c35b6a$b0a17c60$gbl... 


    David Guest

  5. #5

    Default Thanks, folks.

    It appears we have a consensus here.

    Thanks for taking the time to help.
    Sean Guest

Similar Threads

  1. delete FLV again
    By kruak in forum Macromedia Flash Flashcom
    Replies: 6
    Last Post: April 11th, 09:48 PM
  2. Delete form - Post data to a table and delete uponsubmit.
    By FusionRed in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: July 28th, 01:27 PM
  3. Delete button to delete 3D model
    By mindylim in forum Macromedia Director 3D
    Replies: 1
    Last Post: February 18th, 10:47 AM
  4. Delete key doesn't delete when datagrid is bound to a disconnected table
    By Fred Zolar in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: April 1st, 07:47 AM
  5. Replies: 79
    Last Post: September 10th, 02:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139