Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Index DROP & CREATE script

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-22 : 10:13:12
Does anyone have a index DROP and RECREATE script?

------------------------
I think, therefore I am - Rene Descartes

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-22 : 10:37:21
RIght click the index in SSMS and choose Script index as.
Now you can get both the drop syntax and create syntax for index.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-22 : 10:39:33
quote:
Originally posted by ravilobo

Does anyone have a index DROP and RECREATE script?

------------------------
I think, therefore I am - Rene Descartes




Any specific reason for doing it? Do you want to rebuild index ?
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-22 : 10:40:54
I need it for all the tables in the DB,

Here is what I am going to do,
1. drop the index
2. change column collation (you can not change collation if the column has an index)
3. create index




------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-22 : 10:42:40
You can use Generate script task for however you want to script for all tables in DB.
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-22 : 10:53:02
quote:
Originally posted by sodeep

You can use Generate script task for however you want to script for all tables in DB.



I tried that, however it also creates the table script. I don't need the table script. I need only index script.

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-22 : 11:10:28
Can't you choose only index than?
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-22 : 11:17:11
I can not choose only index in SSMS. I am thinking of writing a RegEx to do this.

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-22 : 11:33:32

Check this:

http://www.codeplex.com/SQLSrvScrpt/Wiki/View.aspx?title=DBScript%20Utility&referringTitle=Home
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-22 : 11:45:21
This looks like the exact thing I was looking for. I will check teh utility and let you know. Thank you Sodeep!

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-22 : 13:15:24
Thank you Sodeep! Checked the tool. Works great!!

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

mukkasasai
Starting Member

4 Posts

Posted - 2008-07-23 : 03:20:25
I want to generate script for store prod also . the tool is very good one but it doesnt has option for taking sp scripts .. is there
any think expect generate scripts of SSMS
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 03:36:45
In same tool you can include SP too.
Didn't you play around with the tool to figure out how to use it and learn more?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

mukkasasai
Starting Member

4 Posts

Posted - 2008-07-23 : 04:08:02
DO i not have VS.Net installed my Pc . Ihave only sql server on my machine . do i need to change any code in the sol'n to may sp option avaliable?
Go to Top of Page

mukkasasai
Starting Member

4 Posts

Posted - 2008-07-23 : 04:46:43
can you tell me how i should make use of Sp option using the above tool
Go to Top of Page

mukkasasai
Starting Member

4 Posts

Posted - 2008-07-23 : 04:51:37
Hi ,

can you tell how to make use of SP option ..

Nav

quote:
Originally posted by Peso

In same tool you can include SP too.
Didn't you play around with the tool to figure out how to use it and learn more?



E 12°55'05.25"
N 56°04'39.16"


Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-23 : 08:07:30
Can't you use Generate script task for scripting SPS?
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-23 : 10:46:27
SSMS can take care of SPs. No need for tool.

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page
   

- Advertisement -