Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Friday, March 30, 2012

How to create scripts (drop then create) in sql 2005

I'm using sql 2005. One thing I could do in sql 2k which I don't see in sql
05 is when I script objects in EM it would check to see if the object exists
first, and if so, it would drop it before creating it. I don't see such an
option in sql 05 SSMS. Its a much better scripting wizard but seems to be
missing the most basic functions.
any advice?
Thanks.
moondaddy@.noemail.noemailAs far as I know there is no such choice in the wizard, you would need to
run it twice, one for 'Generate DROP statements only' and one for 'Generate
CREATE statements only'.
Note that the SP1 description still shows 'Generate the script as DROP
statements, CREATE statements, or DROP statements followed by CREATE
statements."
Ben Nevarez, MCDBA, OCP
Database Administrator
"moondaddy" wrote:

> I'm using sql 2005. One thing I could do in sql 2k which I don't see in s
ql
> 05 is when I script objects in EM it would check to see if the object exis
ts
> first, and if so, it would drop it before creating it. I don't see such a
n
> option in sql 05 SSMS. Its a much better scripting wizard but seems to be
> missing the most basic functions.
> any advice?
> Thanks.
> --
> moondaddy@.noemail.noemail
>
>|||Check out http://www.sqlteam.com/item.asp?ItemID=23185 and
http://weblogs.sqlteam.com/billg/ar...1/22/8414.aspx.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"moondaddy" <moondaddy@.noemail.noemail> wrote in message
news:uLMUBQWdGHA.3712@.TK2MSFTNGP03.phx.gbl...
> I'm using sql 2005. One thing I could do in sql 2k which I don't see in s
ql 05 is when I script
> objects in EM it would check to see if the object exists first, and if so,
it would drop it before
> creating it. I don't see such an option in sql 05 SSMS. Its a much bette
r scripting wizard but
> seems to be missing the most basic functions.
> any advice?
> Thanks.
> --
> moondaddy@.noemail.noemail
>

Friday, February 24, 2012

How to correct index problems in system tables

Hi friends, I have one corrupted index in sysobjects from
one user database (not master). The SQL Server don't
accept to use DBCC or drop and recreate the index to
system tables. In my backup the index alread is corrupted.
How can I fix this problem? I'm using SQL 2000 with the
last SP.DBCC DBREINDEX would help in rebuilding the corrupted index. I notice you
say the SQL Server doesn't accept DBCC though.
Why is this..? Permissions .. ?
--
HTH
Ryan Waight, MCDBA, MCSE
"Khayman" <himura@.click21.com.br> wrote in message
news:08d101c3b997$f77eabe0$a401280a@.phx.gbl...
> Hi friends, I have one corrupted index in sysobjects from
> one user database (not master). The SQL Server don't
> accept to use DBCC or drop and recreate the index to
> system tables. In my backup the index alread is corrupted.
> How can I fix this problem? I'm using SQL 2000 with the
> last SP.|||Hi ,
Please use the below undocumented system procedure This stored procedure can
be used to fix a corruption in a system table.
sp_fixindex dbname,tabname,indid
Before using this stored procedure the database has to be in single user
mode
See this link for more information: "How can I fix a corruption in a system
table?"
http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14051
Thanks
Hari
MCDBA
"Khayman" <himura@.click21.com.br> wrote in message
news:08d101c3b997$f77eabe0$a401280a@.phx.gbl...
> Hi friends, I have one corrupted index in sysobjects from
> one user database (not master). The SQL Server don't
> accept to use DBCC or drop and recreate the index to
> system tables. In my backup the index alread is corrupted.
> How can I fix this problem? I'm using SQL 2000 with the
> last SP.|||i have tried this yet.
This only works for nonclustered indexes, but the
corrupted index is clustered.
Khayman.
>--Original Message--
>Hi ,
>Please use the below undocumented system procedure This
stored procedure can
>be used to fix a corruption in a system table.
>sp_fixindex dbname,tabname,indid
>Before using this stored procedure the database has to be
in single user
>mode
>See this link for more information: "How can I fix a
corruption in a system
>table?"
>http://www.windows2000faq.com/Articles/Index.cfm?
ArticleID=14051
>Thanks
>Hari
>MCDBA
>
>"Khayman" <himura@.click21.com.br> wrote in message
>news:08d101c3b997$f77eabe0$a401280a@.phx.gbl...
>> Hi friends, I have one corrupted index in sysobjects
from
>> one user database (not master). The SQL Server don't
>> accept to use DBCC or drop and recreate the index to
>> system tables. In my backup the index alread is
corrupted.
>> How can I fix this problem? I'm using SQL 2000 with the
>> last SP.
>
>.
>|||In Microsoft Documentation says:
"DBCC DBREINDEX is not supported for use on system tables."
I don't know why.
Khayman
>--Original Message--
>DBCC DBREINDEX would help in rebuilding the corrupted
index. I notice you
>say the SQL Server doesn't accept DBCC though.
>Why is this..? Permissions .. ?
>--
>HTH
>Ryan Waight, MCDBA, MCSE
>"Khayman" <himura@.click21.com.br> wrote in message
>news:08d101c3b997$f77eabe0$a401280a@.phx.gbl...
>> Hi friends, I have one corrupted index in sysobjects
from
>> one user database (not master). The SQL Server don't
>> accept to use DBCC or drop and recreate the index to
>> system tables. In my backup the index alread is
corrupted.
>> How can I fix this problem? I'm using SQL 2000 with the
>> last SP.
>
>.
>|||Please contact Product Support who are best placed to help you with this.
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Khayman" <himura@.click21.com.br> wrote in message
news:000101c3b9b7$53f1dfe0$a301280a@.phx.gbl...
> i have tried this yet.
> This only works for nonclustered indexes, but the
> corrupted index is clustered.
> Khayman.
>
> >--Original Message--
> >Hi ,
> >
> >Please use the below undocumented system procedure This
> stored procedure can
> >be used to fix a corruption in a system table.
> >
> >sp_fixindex dbname,tabname,indid
> >
> >Before using this stored procedure the database has to be
> in single user
> >mode
> >
> >See this link for more information: "How can I fix a
> corruption in a system
> >table?"
> >
> >http://www.windows2000faq.com/Articles/Index.cfm?
> ArticleID=14051
> >
> >Thanks
> >Hari
> >MCDBA
> >
> >
> >"Khayman" <himura@.click21.com.br> wrote in message
> >news:08d101c3b997$f77eabe0$a401280a@.phx.gbl...
> >> Hi friends, I have one corrupted index in sysobjects
> from
> >> one user database (not master). The SQL Server don't
> >> accept to use DBCC or drop and recreate the index to
> >> system tables. In my backup the index alread is
> corrupted.
> >> How can I fix this problem? I'm using SQL 2000 with the
> >> last SP.
> >
> >
> >.
> >|||We have the same issue. Did you resolve your problem? How did it go?