Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    3

    Unanswered: sp_dropsegment question.

    I have a baffling problem. If I run this procedure manually (ISQL prompt) it works:

    use mydb
    go
    sp_dropsegment "logsegment", mydb, "mydevice"
    go

    But if I run it from a script:

    isql -Uvaris6 -Pvaris6 -Suss_starship <CleanUpSegments.sql >CleanUpSegments.out

    I get this:

    Msg 17520, Level 16, State 1:
    Procedure 'sp_dropsegment', Line 131:
    There is no such segment as '“logsegment”'.
    (return status = 1)
    Msg 17280, Level 16, State 1:
    Procedure 'sp_extendsegment', Line 135:
    No such device exists -- run sp_helpdb to list the devices for the current
    database.
    (return status = 1)

    The DBO for mydb is varis6 and it has both SA SSO roles.
    "mydb" is the default database for User "varis6"

    Why is it failing inside the script? Any clues or ideas would be greatly appreciated.

    Regards, Les Guyse
    Varian Medical Systems

  2. #2
    Join Date
    Sep 2002
    Location
    Hong Kong
    Posts
    159
    I don't see why the file redirections wouldn't work, but try using the following and see if it makes a difference.

    isql -Uvaris6 -Pvaris6 -Suss_starship -iCleanUpSegments.sql -o CleanUpSegments.out

    Richard.

  3. #3
    Join Date
    Mar 2003
    Posts
    15
    do this

    use mydb
    go
    select db_name()
    go
    sp_dropsegment "logsegment", mydb, "mydevice"
    go

    This will tell you the database you are in mydb or master

    if you are in master and are giving right dev name then it should work
    Hope you are giving the right dev name, try sp_helpsegment to get the dev name
    db_mate

  4. #4
    Join Date
    Mar 2003
    Posts
    2
    Probably not worth mentioning, but if it works manually, the logsegment is no longer there when executing the script. If you recreate the db all the time to test, run checks like select db_name(), sp_helpsegment etc.
    Can you print your script here ? I don't know why you are getting the sp_extendsegment message. If I copy your message it looks like you have some weird chars in your segment name.

Posting Permissions

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