dbTalk Databases Forums  

Can I create a Scipt with only create index command?

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss Can I create a Scipt with only create index command? in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kmoskal@newsgroups.nospam
 
Posts: n/a

Default Can I create a Scipt with only create index command? - 08-26-2008 , 09:27 AM






I'm using SSMS with SQL 2005 SP2. I've been trying to create a script using
the "Generate Script" wizard that only has Drop Index and Create Index
commands. I don’t want the create table command. The database has about 500
tables and it will take me hours to generate a FULL script and manually edit
out all the create table commands. I swear this was an option in the old SQL
2000 Enterprise Manager. I'm I look for a "needle in a haystack?"


--
Kurt

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM






kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #3  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #4  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #5  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #6  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #7  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #8  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #9  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #10  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Can I create a Scipt with only create index command? - 08-27-2008 , 05:41 PM



kmoskal (AT) newsgroups (DOT) nospam (zork (AT) newsgroups (DOT) nospam) writes:
Quote:
I'm using SSMS with SQL 2005 SP2. I've been trying to create a script
using the "Generate Script" wizard that only has Drop Index and Create
Index commands. I don’t want the create table command. The database has
about 500 tables and it will take me hours to generate a FULL script and
manually edit out all the create table commands. I swear this was an
option in the old SQL 2000 Enterprise Manager. I'm I look for a "needle
in a haystack?"
I had a quick look in EM, and I could not find such option. But I have
not used scripting much in EM 2000.

And, no, you cannot do it in SSMS. But I agree that it could be useful.
http://connect.microsoft.com/SqlServer/Feedback/ is a good place to make
your word heard in the issue.

In the mean while, here is a Perl one-liner for you:

perl -ne "BEGIN {$/ = qq!\nGO\n!} print if /CREATE( UNIQUE)? (NON)?CLUSTERED
INDEX/" yourfile.sql

Where yourfile was created by the script wizard in SSMS.

Caveat 1: when you script the database make sure to select output to an ANSI
file.

Caveat 2: this does not include Primary keys and Unique constraints.

Caveat 3: my test file was created by SSMS 2008.


Then again, if you have your code under version control, this should
not really be an issue.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.