xp_cmdshell ??

sql server India
  • 13 years ago

    declare @Command varchar (500)

    Set @Command = 'D:\yogesh\yogesh.csv'
    EXEC master..xp_cmdshell @Command


    is this work in query analyser  ?

    if no then is there any other way to do this ?

    i just want to open file  using  sql query 

     

     

  • 13 years ago

    Try building up the entire xp_cmdshell statement and executing that instead.

    declare @Command nvarchar (500)
    Set @Command = 'EXEC master..xp_cmdshell ''D:\yogesh\yogesh.csv'''
    exec sp_executesql @Command

     

     

     

  • 13 years ago

    hi Timl,

    its not working!!

  • 13 years ago
  • 13 years ago

    You say it's not working.What error are you getting? Is the user you're using have execute permissions for the xp_cmdshell ?

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If Java had true garbage collection, most programs would delete themselves upon execution.” - Robert Sewell