Click here to Skip to main content
15,614,270 members
Articles / Database Development / SQL Server / SQL Server 2008
Posted 24 Jan 2016


3 bookmarked

SMO Tutorial 3 of n - Scripting

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
24 Jan 2016CPOL
This is an alternative for "SMO Tutorial 3 of n - Scripting"


  • Added FormLogin allowing Windows Authentication or SQL Server Authentication
  • Added Keys, indexes and constraints
  • Added SQL Server 2008 R2 support
  • Fixed syntax coloring
  • Updated solution to VS2013

Points of Interest

When using the generated scripts on different SQL Server versions, be sure to edit the CREATE DATABASE statement. The simplest way to make sure this works is to change it to:


(without any of the complex file name options).

Tested on Windows 7 / Windows Vista, SQL Server 2008 R2 / 2012.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer
Netherlands Netherlands
Software developer in the Netherlands, currently working on Video Surveillance applications.
Experience: C#, C++, VB, ASP, SQL Server, PostgreSQL, Gitea, TeamCity.
It all started with Black&White, no not the whiskey but the Sinclair ZX81 followed by several Atari's and PC's. The journey continues ...

Comments and Discussions

QuestionMessage Closed Pin
19-Mar-22 2:22
Isidro Padilla19-Mar-22 2:22 
QuestionMessage Closed Pin
19-Mar-22 2:21
Isidro Padilla19-Mar-22 2:21 
QuestionNice Pin
Isidro Padilla19-Mar-22 2:24
Isidro Padilla19-Mar-22 2:24 
AnswerRe: Nice Pin
RickZeeland19-Mar-22 3:13
mveRickZeeland19-Mar-22 3:13 
GeneralRe: Nice Pin
Isidro Padilla19-Mar-22 9:01
Isidro Padilla19-Mar-22 9:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.