| Author |
Topic |
|
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2008-05-07 : 11:31:57
|
| Hello,How would I script the PK, FK, unique constraints and indexes of SQL 2005 using SSMS? I tried and it creates the table script as well.Thanks,-S |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-05-07 : 11:36:23
|
| It uses Alter table. Go to indexes and script as. |
 |
|
|
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2008-05-07 : 11:56:33
|
| Can you be more specific. I tried to create the script for PK. To do that I selected Create Script - True and Primary key - true and the script has create table statements as well. Thanks,-S |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-05-07 : 12:03:20
|
| When you script table. It already creates scripts for Pk,FK and constraints . Otherwise go to FK and script that. Go to indexes and script. |
 |
|
|
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2008-05-07 : 12:04:11
|
| I should be able to script the indexes/PK/FK for all the tables in my database at once. |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-05-07 : 12:07:57
|
| Right click database - Tasks -Generate scripts. Script whatever you need to for your database. |
 |
|
|
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2008-05-07 : 12:08:23
|
| I can not script the constraints when I script the tables due to the collation issues. Is there a way to scirpt only the constraints of all the tables using SSMS interface? I know we can do it in Enterprise Manager. |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-05-07 : 12:11:58
|
| you aren't listening. |
 |
|
|
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2008-05-07 : 12:17:37
|
| Did you try to just script the PK constraints? Try and see.. It will script the create table statements as well. |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-05-07 : 15:27:23
|
| You can't in ssms, but you can edit the script. |
 |
|
|
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2008-05-07 : 16:24:42
|
| I know that. Editing a script of 500+ tables is headacheThanks,-S |
 |
|
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2008-05-09 : 09:28:37
|
quote: Originally posted by sqlpal2007 I know that. Editing a script of 500+ tables is headache
...not if you know regular expressions!------------------------I think, therefore I am - Rene Descartes |
 |
|
|
|