rename a table

  • is it possible to rename a table in a linked server?

    I woyuld like to know also is it possible to rename a Excel worksheet with Tsql

    Thanks for your help

  • if its a sql table have a look at sp_rename if its an excel spreaqdsheet use xp_cmdshell with dos commands.

    www.sql-library.com[/url]

  • in dos command there no switch for renaming a worksheet

  • "in dos command there no switch for renaming a worksheet "

    A worksheet isn't any different from any other file on the file system.  Use REN/RENAME.

    From DOS help -

    C:\> REN /?

    Renames a file or files.

    RENAME [drive:][path]filename1 filename2.

    REN [drive:][path]filename1 filename2.

    Note that you cannot specify a new drive or path for your destination file.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • i think i am maybe not clear enought

    the goal is to rename the worksheet that is inside the workbook

    example:

    i have a workbook TEST.xls that have inside 2 worksheets

    1)test1

    2)test2

    i would like to rename test1 to test3

    thank you for your help

  • As far as I know the only way to rename a worksheet in a workbook through code is to use the Excel API. Which I don't think you can do they way you are wanting to do this.

  • create a SQL scheduled job written in VBScript then call the job using T-SQL.

    www.sql-library.com[/url]

  • Yes, you can rename a worksheet (inside a workbook) from SQL.

    Lookup using sp_OACreate and related sprocs, and use the Excel Automation object to rename a worksheet.



    Mark

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply