Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Error 15335 - is already in use as a object name... Expand / Collapse
Author
Message
Posted Thursday, November 8, 2012 6:11 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, September 6, 2013 4:06 AM
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).
Post #1382448
Posted Thursday, November 8, 2012 6:16 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, July 22, 2014 7:33 AM
Points: 1,361, Visits: 15,264
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
Post #1382452
Posted Thursday, November 8, 2012 6:22 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 7:52 AM
Points: 165, Visits: 679
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

Post #1382457
Posted Thursday, November 8, 2012 7:17 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, September 6, 2013 4:06 AM
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.

Post #1382479
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse