|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:02 PM
Points: 6,367,
Visits: 8,228
|
|
ssaari (3/25/2009) Thank you, Wayne,
I looked at a couple of table scripts and didn't notice anything wrong. What kind of issues did you see if you don't mind?
Scott
The thing I noticed is that the script only gets the first key (of Primary, Foreign or Unique keys)... primary if one is there. If the table has multiple (PK, 2+ FK, etc.) it only gets the PK. If the table doesn't have a PK, and has 2+ FKs, it only gets the first FK. Indexes, defaults and check constraints looked okay.
Wayne Microsoft Certified Master: SQL Server 2008 If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it! Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines, CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 8:20 AM
Points: 220,
Visits: 350
|
|
| I'm interested in seeing how MS gets the data returned by particular views and functions/procedures. In 2000 I needed a view that would return user information from syslogins but without the password column. (the querying account did not have privileges to read the password column.) So I got the source for syslogins and created my own version minus the password column. In this case it worked because I could select from sysxlogins.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:47 AM
Points: 5,201,
Visits: 11,151
|
|
great article. For free source control try Subversion, you can get it at
http://subversion.tigris.org/
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 6:53 AM
Points: 6,
Visits: 440
|
|
| SQLDMO doesn't expose triggers that I can see(via Intellisense on oSQL). How could this script be modified to include the scripting of triggers?
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Monday, September 10, 2012 12:31 PM
Points: 56,
Visits: 129
|
|
hello,
Take a look at the script (line 187). It uses the SQLDMOScript_Triggers property. This means that when the call to object.script (line 196) is made, the trigger will also be generated inside the TAB file for that table. I often used this option, and I am able to get the triggers that way.
If you need to, the table object exposes a triggers collection which allows you to select each trigger object.
I hope this helps
http://ozkary.blogspot.com http://og-bit.com
|
|
|
|