Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    2

    Unanswered: xp_cmdshell Resultset in ASE DB?

    I've got a problem to recieve the resultset from xp_cmdshell. It is not possible to install my stored procedur in the database. The following statement causes an error while installing:

    ...
    ...
    begin
    create table #result (result varchar(255))
    select @command = "${XP_DIR}/script1.sh"
    insert #result exec ${DB}.dbo.xp_cmdshell @command, resturn_status, no_output
    end

    How else can I get a resultset from the xp_cmdshell??

  2. #2
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524
    1. Be sure that the sybase unix login knows all the necessary environment variables.
    2. the last line cannot be executed without using dynamic SQL
    F. Celaia
    DBA Sybase/DB2/Oracle/MS-SQL

  3. #3
    Join Date
    Jun 2004
    Posts
    2
    Could you give me an example for this statement using dynamic sql?

  4. #4
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524
    declare @sql varchar(100)

    select @sql='select name from '+db_name(5)+' where type ="U"'
    execute (@sql)
    F. Celaia
    DBA Sybase/DB2/Oracle/MS-SQL

Posting Permissions

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