February 17, 2003 at 11:09 am
what script method parameter can i use to get the check constraint name in a table object. i.e. SQLDMOScript_DRI_All
currently table is just displayed like this:
CREATE TABLE [jobs5] (
[job_id] [smallint] IDENTITY (1, 1) NOT NULL ,
[min_lvl] [tinyint] NOT NULL ,
[max_lvl] [tinyint] NOT NULL ,
CHECK ([max_lvl] <= 250),
CHECK ([min_lvl] >= 10)
) ON [PRIMARY]
Brian Lockwood
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
February 20, 2003 at 8:00 am
This was removed by the editor as SPAM
February 20, 2003 at 9:11 am
Those reminders are handy, I missed the question. Using all should return the contstraints inside an alter statement. Thats enough, or you need to filter it more/differently?
Andy
February 20, 2003 at 9:17 am
thx for reply but you can see the result with the option i use.
what parameter are you refering to exactly that will script the check constraint NAMES out in alter statements?
TIA
Brian Lockwood
LockwoodTech Software
EDITED TO SPEDICFY "constraint NAMES "
Edited by - brian_lockwood on 02/20/2003 09:28:27 AM
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
February 20, 2003 at 12:15 pm
more info ...
in some cases the all_dri param i used does show the alter statements
alter table [dbo].[jobs] nocheck constraint [CK__jobs__min_lvl__1367E606]
GO
but in others it doesn't. it relates to how the tables were created. if you create the table using my original syntax posted above - sqldmo will not show you the alter statements with constraint names if you script it. the constraint names exist (sql server assigns them automatically) but won't show them in DMO.
CONCLUSION
so i think the bottom line is that unless you specifiy constraint name on creation with a sql statement you can't script out the names (even though they exists). but if you do then so will sqldmo.
Brian Lockwood
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
February 20, 2003 at 1:02 pm
Nothing built in, was thinking if you needed a subset you'd add code to filter it at run time. Interesting conclusion. Havent dug enough to confirm yet, be more interesting to figure out why!
Andy
February 24, 2003 at 5:33 am
hi! you might want to have a look at the following link, to get the check constraint names manually at least.
http://www.sqlservercentral.com/scripts/contributions/246.asp
best regards,
c.
February 24, 2003 at 8:07 am
great thanks. this is a good script
Brian Lockwood
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply