Professional Web Applications Themes

extended procedure xp_fileexist - Microsoft SQL / MS SQL Server

I have a .txt file located in a shared directory named 'share' on a server named 'SRV' I would like use the extended procedure xp_fileexist like this: declare resp as integer exec xp_fileexist '\SRV\share\filename.txt', resp output select resp as response what's the correct syntax? thanks in advance dario casubolo...

  1. #1

    Default extended procedure xp_fileexist

    I have a .txt file located in a shared directory
    named 'share' on a server named 'SRV'

    I would like use the extended procedure xp_fileexist like
    this:

    declare resp as integer
    exec xp_fileexist '\\SRV\share\filename.txt', resp output
    select resp as response

    what's the correct syntax?

    thanks in advance

    dario casubolo
    dario Guest

  2. #2

    Default Re: extended procedure xp_fileexist

    Hi Dario,

    The syntax is correct, but only if you run the procedure in the master
    database. If you want to use it from any other database you have to prefix
    the extended procedure name with master..

    declare resp as integer
    exec master..xp_fileexist '\\SRV\share\filename.txt', resp output
    select resp as response

    This is a different behaviour than that of system stored procedures stored
    in the master database that start with sp_, which you can call from any
    database without having to use the master.. prefix. You have to prefix all
    extended stored procedures with master.. if you want them in a different
    database.

    --
    Jacco Schalkwijk MCDBA, MCSD, MCSE
    Database Administrator
    Eurostop Ltd.


    "dario casubolo" <it> wrote in message
    news:098401c35d9a$5b4c9c40$gbl... 


    Jacco Guest

  3. #3

    Default Re: extended procedure xp_fileexist

    Please be aware that this will fail if you service security context is
    LocalSystem or a local machine account (assuming the UNC name points to a
    remote server).

    Net

    Please reply only to the newsgroups.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    You assume all risk for your use.
    Copyright SQLDev.Net 1991-2003 All rights reserved.

    "Jacco Schalkwijk" <co.uk> wrote in message
    news:%phx.gbl... 
    >
    >[/ref]


    Gert Guest

Similar Threads

  1. use extended procedure without cursors
    By Jacco in forum Microsoft SQL / MS SQL Server
    Replies: 6
    Last Post: July 15th, 04:01 PM
  2. Extended stored procedure and Cursors
    By Partha Mandayam in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 9th, 02:34 AM

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