Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Error 15335 - is already in use as a object name...


Error 15335 - is already in use as a object name...

Author
Message
mrichardson 57577
mrichardson 57577
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 82
I am getting this error:
Error 15335 - is already in use as a object name...
when trying to rename a view in sql2005.

The view name does not appear in the list in object explorer.
If I run this query:
select * from sysobjects where name like '%myView_ForumPermissions%'


- I can then see the view.

If I run this query to remove it:
TRUNCATE table myView_ForumPermissions


- it says it ran succsessful, but it doesn not actually delete it.

The reason for removing it is because I am changing schemas from one schema to another (becasue after several upgrades some views and stored procedures are not using the intended .dbo schema, so i'm finding the missing ones and copying across).
MysteryJimbo
MysteryJimbo
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1348 Visits: 15327
mrichardson 57577 (11/8/2012)
I am getting this error:
Error 15335 - is already in use as a object name...
when trying to rename a view in sql2005.

The view name does not appear in the list in object explorer.
If I run this query:
select * from sysobjects where name like '%myView_ForumPermissions%'


- I can then see the view.

If I run this query to remove it:
TRUNCATE table myView_ForumPermissions


- it says it ran succsessful, but it doesn not actually delete it.

The reason for removing it is because I am changing schemas from one schema to another (becasue after several upgrades some views and stored procedures are not using the intended .dbo schema, so i'm finding the missing ones and copying across).


TRUNCATE does not remove objects.

Try DROP VIEW
bleroy
bleroy
SSC-Enthusiastic
SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)

Group: General Forum Members
Points: 172 Visits: 739
A view is exactly that, a constructed view of the underlying tables, essentially a saved or materialized SQL (SELECT) query.

If you want to truncate the view, then really you should truncate the underlying tables, not the view itself (obviously you can delete rows from a view which may filter to the underlying table provided it meets certain conditions) - I don't think that even if the conditions are met, that can apply the TRUNCATE command to the view and affect the underlying table.

As indicated in previous answer - you can drop the view - again, by doing so, you will not have any impact on the underlying tables/data.

Saying that, the error message displayed is a little poor, which doesn't help,

HTH,

B
mrichardson 57577
mrichardson 57577
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 82
thanks for the replies.

it turns out that the name of my view had been created in error as a table, thats why i couldn't see it in the object explorer window.

therefore used drop table and then managed to re-create the view.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search